Socket
Socket
Sign inDemoInstall

@snyk/error-catalog-nodejs-public

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@snyk/error-catalog-nodejs-public - npm Package Compare versions

Comparing version 5.7.1 to 5.8.0

2

package.json
{
"name": "@snyk/error-catalog-nodejs-public",
"version": "5.7.1",
"version": "5.8.0",
"type": "commonjs",

@@ -5,0 +5,0 @@ "author": "snyk.io",

@@ -22,5 +22,6 @@ /*

readonly cause?: Error | undefined;
readonly logs?: string[] | undefined;
private readonly id;
readonly isErrorCatalogError = true;
constructor(metadata: ErrorMetadata, detail: string, additionalData?: Record<string, any> | undefined, cause?: Error | undefined);
constructor(metadata: ErrorMetadata, detail: string, additionalData?: Record<string, any> | undefined, cause?: Error | undefined, logs?: string[] | undefined);
format(instance: string, formatType: ErrorFormats): ProblemJson | JsonApi;

@@ -27,0 +28,0 @@ toProblemJson(instance: string): ProblemJson;

@@ -23,3 +23,7 @@ /*

class ProblemError extends Error {
constructor(metadata, detail, additionalData, cause) {
constructor(metadata, detail, additionalData, cause,
// Logs or tracebacks or other relevant information that should be displayed to the consumer or end-user.
// NOTE! These logs will be displayed to end-users and potentially customers of Snyk. They *will* be monitored by
// ProdSec and should therefore never contain sensitive information, neither about customer data nor Snyk infrastructure.
logs) {
super(metadata.title);

@@ -30,2 +34,3 @@ this.metadata = metadata;

this.cause = cause;
this.logs = logs;
// Since `instanceof` cannot be relied upon for class checks in situations where the `ProblemError` was thrown from a dependency of the executing app, we need a more viable solution.

@@ -52,3 +57,3 @@ // See: https://stackoverflow.com/questions/41587865/using-instanceof-on-objects-created-with-constructors-from-deep-npm-dependenci/41592087#41592087

toProblemJson(instance) {
const payload = Object.assign({ type: this.metadata.type, title: this.metadata.title, status: this.metadata.status, errorCode: this.metadata.errorCode, detail: this.detail, classification: this.metadata.classification, instance }, this.additionalData);
const payload = Object.assign({ type: this.metadata.type, title: this.metadata.title, status: this.metadata.status, errorCode: this.metadata.errorCode, detail: this.detail, classification: this.metadata.classification, instance, logs: this.logs }, this.additionalData);
return new types_1.ProblemJson(payload);

@@ -83,2 +88,5 @@ }

}
if (this.logs) {
jsonApiErrorObject.meta['logs'] = this.logs;
}
return jsonApiErrorObject;

@@ -96,3 +104,3 @@ }

static fromJsonApiErrorObject(obj) {
var _a, _b;
var _a;
const metadata = {

@@ -103,3 +111,3 @@ title: obj.title,

status: Number(obj.status),
classification: (_b = obj.meta) === null || _b === void 0 ? void 0 : _b.classification,
classification: obj.meta.classification,
};

@@ -110,3 +118,3 @@ const additionalData = Object.assign(Object.assign({}, obj.meta), {

overrideErrorId: obj.id });
const instance = new ProblemError(metadata, obj.detail, additionalData);
const instance = new ProblemError(metadata, obj.detail, additionalData, undefined, obj.meta.logs);
// Remove it again to ensure we don't change the signature of the incoming object

@@ -113,0 +121,0 @@ if (instance.additionalData && instance.additionalData['overrideErrorId']) {

@@ -22,19 +22,10 @@ /*

export type Problem = {
/** A URI reference that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type. */
type: string;
/** A short, human-readable summary of the problem type. This should not chance from occurrence to occurrence of the problem.*/
title: string;
/** A human-readable explanation specific to this occurrence of the problem. */
detail: string;
/** The HTTP status code generated by the origin server for this occurrence of the problem. */
status: number;
/** An internal code for the error that occurred. */
errorCode: string;
/** A URI that identifies the specific occurrence of the problem. */
instance?: string;
/** The level of this error */
level?: string;
/** Determining whether this error is a failure of Snyk to handle an operation that it was expected to, or if it derives from a requesting service producing something that cannot be handled. */
classification: Classification;
/** Additional properties. */
[x: string]: any;

@@ -74,6 +65,7 @@ };

source?: JsonApiErrorSource;
meta?: {
meta: {
[x: string]: any;
isErrorCatalogError: boolean;
classification?: Classification;
logs?: string[];
};

@@ -80,0 +72,0 @@ };

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