@stoplight/prism-core
Advanced tools
Comparing version 3.2.6 to 3.2.7
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./types"), exports); | ||
tslib_1.__exportStar(require("./factory"), exports); | ||
tslib_1.__exportStar(require("./logger"), exports); |
@@ -56,19 +56,1 @@ import { IDiagnostic } from '@stoplight/types'; | ||
} | ||
export declare type ProblemJson = { | ||
type: string; | ||
title: string; | ||
status: number; | ||
detail: string; | ||
}; | ||
export declare class ProblemJsonError extends Error { | ||
readonly name: string; | ||
readonly message: string; | ||
readonly status: number; | ||
readonly detail: string; | ||
static fromTemplate(template: Omit<ProblemJson, 'detail'>, detail?: string): ProblemJsonError; | ||
static fromPlainError(error: Error & { | ||
detail?: string; | ||
status?: number; | ||
}): ProblemJson; | ||
constructor(name: string, message: string, status: number, detail: string); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class ProblemJsonError extends Error { | ||
constructor(name, message, status, detail) { | ||
super(message); | ||
this.name = name; | ||
this.message = message; | ||
this.status = status; | ||
this.detail = detail; | ||
} | ||
static fromTemplate(template, detail) { | ||
const error = new ProblemJsonError(`https://stoplight.io/prism/errors#${template.type}`, template.title, template.status, detail || ''); | ||
return error; | ||
} | ||
static fromPlainError(error) { | ||
return { | ||
type: error.name && error.name !== 'Error' ? error.name : 'https://stoplight.io/prism/errors#UNKNOWN', | ||
title: error.message, | ||
status: error.status || 500, | ||
detail: error.detail || '', | ||
}; | ||
} | ||
} | ||
exports.ProblemJsonError = ProblemJsonError; |
{ | ||
"name": "@stoplight/prism-core", | ||
"version": "3.2.6", | ||
"version": "3.2.7", | ||
"main": "dist/index.js", | ||
@@ -26,3 +26,3 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "0d6b0b31aca7a77cfa584c8e2cc9f313a079666a" | ||
"gitHead": "cc77775c9c684ab02d0d5d1036c92aacd77e24c8" | ||
} |
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
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
18053
157