@stoplight/prism-core
Advanced tools
Comparing version 3.3.0-alpha.0 to 3.3.0-beta.0
"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.3.0-alpha.0", | ||
"version": "3.3.0-beta.0", | ||
"main": "dist/index.js", | ||
@@ -26,3 +26,3 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "633905da52ce828ab54f9183b8f30211b9e30767" | ||
"gitHead": "8567caf2d808c60e899bff02b630cfcd243ac1b1" | ||
} |
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
18060
157