Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@storyous/common-utils

Package Overview
Dependencies
Maintainers
5
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storyous/common-utils - npm Package Compare versions

Comparing version 7.1.1 to 8.0.0

lib/models/log.js

25

lib/appError.js

@@ -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 @@

6

lib/errorHandler.js

@@ -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 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc