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

@springworks/error-factory

Package Overview
Dependencies
Maintainers
0
Versions
434
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@springworks/error-factory - npm Package Compare versions

Comparing version 3005.367.0 to 3005.383.0

3

build/client-error/client-error.js

@@ -21,6 +21,5 @@ "use strict";

function createClientErrorForResponse(response) {
var _a;
let code = 'client-error';
let message = 'Client error';
if ((_a = response.body) === null || _a === void 0 ? void 0 : _a.error) {
if (response.body?.error) {
code = response.body.error.code;

@@ -27,0 +26,0 @@ message = response.body.error.message;

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

function getStatusCode(code, cause) {
var _a;
if (typeof code === 'number' && code >= 400 && http_1.STATUS_CODES[code]) {

@@ -20,3 +19,3 @@ return code;

if (cause) {
if ((_a = cause.output) === null || _a === void 0 ? void 0 : _a.statusCode) {
if (cause.output?.statusCode) {
return getStatusCode(cause.output.statusCode, null);

@@ -47,5 +46,4 @@ }

function toStringDebug() {
var _a;
const has_annotate = typeof this.annotate === 'function';
const details = has_annotate ? this.annotate() : (0, util_1.format)(' %j', (_a = this.output) === null || _a === void 0 ? void 0 : _a.payload);
const details = has_annotate ? this.annotate() : (0, util_1.format)(' %j', this.output?.payload);
return `Error: ${String(this.code)} ${String(this.message)}:\n${String(details)}`;

@@ -60,6 +58,5 @@ }

function createError(params) {
var _a, _b;
const { code, message, cause, root_error_id, stack_from } = useParamsOrDefaults(params);
const error = new Error(message !== null ? message : undefined);
Error.captureStackTrace(error, stack_from !== null && stack_from !== void 0 ? stack_from : createError);
Error.captureStackTrace(error, stack_from ?? createError);
const error_code = getStatusCode(code, cause);

@@ -71,3 +68,3 @@ (0, boom_1.boomify)(error, { statusCode: error_code });

error.output.payload.error_id = error_id;
const root_id = (_a = getRootErrorId(root_error_id, cause)) !== null && _a !== void 0 ? _a : error_id;
const root_id = getRootErrorId(root_error_id, cause) ?? error_id;
error.root_error_id = root_id;

@@ -89,3 +86,3 @@ error.output.payload.root_error_id = root_id;

'headers' in cause.output &&
((_b = cause === null || cause === void 0 ? void 0 : cause.output) === null || _b === void 0 ? void 0 : _b.headers)) {
cause?.output?.headers) {
error.output.headers = cause.output.headers;

@@ -92,0 +89,0 @@ }

@@ -18,5 +18,4 @@ "use strict";

function getOutputPayload() {
var _a;
return (_a = this.output) === null || _a === void 0 ? void 0 : _a.payload;
return this.output?.payload;
}
//# sourceMappingURL=internals.js.map

@@ -32,9 +32,6 @@ "use strict";

toJSON: {
value: () => {
var _a;
return ({
...(_a = error.output) === null || _a === void 0 ? void 0 : _a.payload, // old goodies like root_error_id, error_id and statusCode
...(params ? pickHumanFriendlyInput(params) : undefined),
});
},
value: () => ({
...error.output?.payload, // old goodies like root_error_id, error_id and statusCode
...(params ? pickHumanFriendlyInput(params) : undefined),
}),
enumerable: true,

@@ -41,0 +38,0 @@ },

{
"name": "@springworks/error-factory",
"version": "3005.367.0",
"version": "3005.383.0",
"description": "Custom error that makes use of HTTP error codes to identify different error types.",

@@ -15,3 +15,3 @@ "main": "build/main.js",

"@springworks/random-string": "3005.329.0",
"@springworks/swagger-schema-interfaces": "3005.367.0"
"@springworks/swagger-schema-interfaces": "3005.383.0"
},

@@ -30,3 +30,3 @@ "devDependencies": {

"homepage": "https://github.com/Springworks/m2h-mono/tree/master/packages/error-factory#readme",
"gitHead": "c223d0c52b878187b722ea99bdc96ba2d42a1651"
"gitHead": "bfbe4802c0b6ed4b0b889bd654bb8b919d3f40b4"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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