Socket
Socket
Sign inDemoInstall

@vitrical/utils

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitrical/utils - npm Package Compare versions

Comparing version 1.5.5 to 1.5.6

1

api.d.ts
export declare class ApiError extends Error {
url: string;
status: number;
body: any;
headers: {

@@ -6,0 +5,0 @@ [key: string]: any;

@@ -76,3 +76,2 @@ "use strict";

const apiError = new ApiError(message);
apiError.body = 'data' in err.response ? err.response.data : err.response;
apiError.headers =

@@ -79,0 +78,0 @@ 'headers' in err.response &&

21

express.js

@@ -12,16 +12,5 @@ "use strict";

const forwarded = req.headers['x-forwarded-for'] || req.ip || req.socket.remoteAddress;
console.error(`${method} ${path} from ${forwarded} errored`);
if (err instanceof api_1.ApiError) {
console.error(err.message);
console.error(err.stack);
console.error(`${method} ${path} from ${forwarded} errored: `, err.status, err.msg || err.message, err.stack);
res.status(err.status).send({
msg: err.message + `\nat ${err.url}\n`,
body: err.body,
});
return;
}
else if (typeof err === 'object' && 'message' in err && 'stack' in err) {
console.error(err.message);
console.error(err.stack);
res.status(500).send({
msg: err.message + '',

@@ -31,6 +20,10 @@ });

}
console.error(err);
if (typeof err === 'object' && !!err && 'stack' in err && typeof err.stack === 'string') {
console.error(`${method} ${path} from ${forwarded} errored: `, err, err.stack);
}
else {
console.error(`${method} ${path} from ${forwarded} errored: `, err);
}
res.status(500).send({
msg: 'An unexpected error has occured',
err,
});

@@ -37,0 +30,0 @@ };

{
"name": "@vitrical/utils",
"version": "1.5.5",
"version": "1.5.6",
"description": "Collection of useful functions and typings",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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