@storyous/common-utils
Advanced tools
Comparing version 7.1.1 to 8.0.0
@@ -50,2 +50,7 @@ 'use strict'; | ||
function purifyStack (error) { | ||
error.stack = error.stack.split('\n').filter((line, index) => index !== 1).join('\n'); | ||
return error; | ||
} | ||
/** | ||
@@ -63,6 +68,8 @@ * @param {string} [message] | ||
return new AppError(allMessage, Object.assign({ | ||
const error = new AppError(allMessage, Object.assign({ | ||
code: 404, | ||
httpStatus: 404 | ||
}, meta)); | ||
return purifyStack(error); | ||
}; | ||
@@ -82,6 +89,8 @@ | ||
return new AppError(allMessage, Object.assign({ | ||
const error = new AppError(allMessage, Object.assign({ | ||
code: 400, | ||
httpStatus: 400 | ||
}, meta)); | ||
return purifyStack(error); | ||
}; | ||
@@ -101,6 +110,8 @@ | ||
return new AppError(allMessage, Object.assign({ | ||
const error = new AppError(allMessage, Object.assign({ | ||
code: 409, | ||
httpStatus: 409 | ||
}, meta)); | ||
return purifyStack(error); | ||
}; | ||
@@ -119,6 +130,8 @@ | ||
return new AppError(allMessage, Object.assign({ | ||
const error = new AppError(allMessage, Object.assign({ | ||
code: 401, | ||
httpStatus: 401 | ||
}, meta)); | ||
return purifyStack(error); | ||
}; | ||
@@ -138,6 +151,8 @@ | ||
return new AppError(allMessage, Object.assign({ | ||
const error = new AppError(allMessage, Object.assign({ | ||
code: 500, | ||
httpStatus: 500 | ||
}, meta)); | ||
return purifyStack(error); | ||
}; | ||
@@ -144,0 +159,0 @@ |
@@ -67,10 +67,10 @@ 'use strict'; | ||
if (err.httpStatus === 404 || err.httpStatus === 401 || err.httpStatus === 429) { | ||
log.w(err, metaData); | ||
log.warn(err, metaData); | ||
} else if (err.httpStatus === 500 || err.httpStatus === 408) { | ||
log.e(err, metaData); | ||
log.error(err, metaData); | ||
} else { | ||
metaData.response = err; | ||
log.i(err, metaData); | ||
log.info(err, metaData); | ||
} | ||
@@ -77,0 +77,0 @@ |
@@ -60,3 +60,9 @@ 'use strict'; | ||
const responseText = await response.text().catch(err => `RESPONSE BODY NOT PARSABLE: ${err}`); | ||
throw errorWith(new Error('Response is not ok'), url, options, response, responseText); | ||
throw errorWith( | ||
new Error(`Response status ${response.status} is not ok`), | ||
url, | ||
options, | ||
response, | ||
responseText | ||
); | ||
} | ||
@@ -63,0 +69,0 @@ |
@@ -23,3 +23,3 @@ 'use strict'; | ||
if (err) { | ||
log.e('Migrations did not run due to error', err); | ||
log.error('Migrations did not run due to error', err); | ||
reject(err); | ||
@@ -30,7 +30,7 @@ return; | ||
set.on('warning', (msg) => { | ||
log.w('warning', msg); | ||
log.warn('warning', msg); | ||
}); | ||
set.on('migration', (migration, direction) => { | ||
log.i(`Running ${direction} migration`, migration.title); | ||
log.info(`Running ${direction} migration`, migration.title); | ||
}); | ||
@@ -40,3 +40,3 @@ | ||
if (error) { | ||
log.e('Migration ends with error', error); | ||
log.error('Migration ends with error', error); | ||
reject(error); | ||
@@ -47,3 +47,3 @@ return; | ||
log.i('Migrations successfully ran'); | ||
log.info('Migrations successfully ran'); | ||
resolve(); | ||
@@ -50,0 +50,0 @@ }); |
{ | ||
"name": "@storyous/common-utils", | ||
"version": "7.1.1", | ||
"version": "8.0.0", | ||
"description": "Common utils for storyous microservices", | ||
@@ -20,4 +20,2 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@storyous/winston-gelf": "0.0.3", | ||
"@storyous/winston-raven-sentry": "2.1.0", | ||
"handlebars": "^4.0.11", | ||
@@ -32,4 +30,5 @@ "lodash": "^4.17.11", | ||
"supertest": "^3.1.0", | ||
"winston": "^2.4.2", | ||
"winston-loggly-bulk": "^2.0.3" | ||
"winston": "^3.2.1", | ||
"winston-loggly-bulk": "^3.0.1", | ||
"winston-sentry-raven-transport": "git+https://github.com/VaclavObornik/winston-sentry-raven-transport.git#fingerprintPropagation" | ||
}, | ||
@@ -36,0 +35,0 @@ "devDependencies": { |
@@ -34,3 +34,3 @@ 'use strict'; | ||
await assert.rejects(() => fetch(url), { | ||
message: 'Response is not ok', | ||
message: 'Response status 500 is not ok', | ||
meta: { request: { url, method: 'GET' }, response: { status, body } } | ||
@@ -37,0 +37,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85370
12
2469
1
+ Added@colors/colors@1.5.01.6.0(transitive)
+ Added@dabh/diagnostics@2.0.3(transitive)
+ Added@types/triple-beam@1.3.5(transitive)
+ Addedasync@3.2.6(transitive)
+ Addedaxios@1.7.4(transitive)
+ Addedcolor@3.2.1(transitive)
+ Addedcolor-string@1.9.1(transitive)
+ Addedcolorspace@1.1.4(transitive)
+ Addedenabled@2.0.0(transitive)
+ Addedfecha@4.2.3(transitive)
+ Addedfn.name@1.1.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedis-arrayish@0.3.2(transitive)
+ Addedis-stream@2.0.1(transitive)
+ Addedkuler@2.0.0(transitive)
+ Addedlodash.clonedeep@4.5.0(transitive)
+ Addedlogform@2.7.0(transitive)
+ Addedmoment@2.29.4(transitive)
+ Addednode-loggly-bulk@4.0.2(transitive)
+ Addedone-time@1.0.0(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-stable-stringify@2.5.0(transitive)
+ Addedsimple-swizzle@0.2.2(transitive)
+ Addedtext-hex@1.0.0(transitive)
+ Addedtriple-beam@1.4.1(transitive)
+ Addedwinston@3.10.03.17.0(transitive)
+ Addedwinston-loggly-bulk@3.3.2(transitive)
+ Addedwinston-transport@4.5.04.9.0(transitive)
- Removed@storyous/winston-gelf@0.0.3
- Removed@storyous/winston-raven-sentry@2.1.0
- Removed@storyous/winston-gelf@0.0.3(transitive)
- Removed@storyous/winston-raven-sentry@2.1.0(transitive)
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasync@2.6.4(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcharenc@0.0.2(transitive)
- Removedcolors@1.0.3(transitive)
- Removedcookie@0.3.1(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removedcrypt@0.0.2(transitive)
- Removedcycle@1.0.3(transitive)
- Removeddashdash@1.14.1(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedeyes@0.1.8(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgelf-pro@1.3.12(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmd5@2.3.0(transitive)
- Removednode-loggly-bulk@2.2.5(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedraven@2.6.4(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtimed-out@4.0.1(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.3.2(transitive)
- Removedverror@1.10.0(transitive)
- Removedwinston@2.4.7(transitive)
- Removedwinston-loggly-bulk@2.0.3(transitive)
- Removedwinston-transport@3.2.1(transitive)
Updatedwinston@^3.2.1
Updatedwinston-loggly-bulk@^3.0.1