egg-errors
Advanced tools
Comparing version 2.2.1 to 2.2.2
2.2.2 / 2021-04-06 | ||
================== | ||
**fixes** | ||
* [[`4e41373`](http://github.com/eggjs/egg-errors/commit/4e41373129601aa4e09faef21c607f432f9d1105)] - fix: judge frameworkError ins replace to Symbol.for (mansonchor.github.com <<mansonchor1987@gmail.com>>) | ||
2.2.1 / 2021-03-29 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -11,3 +11,3 @@ "use strict"; | ||
let errMessage = err.message; | ||
if (err instanceof framework_base_error_1.FrameworkBaseError) { | ||
if (framework_base_error_1.FrameworkBaseError.isFrameworkError(err)) { | ||
errMessage += ` [${this.faqPrefixEnv || this.faqPrefix}/${err.code}]`; | ||
@@ -19,3 +19,3 @@ } | ||
static formatError(err) { | ||
if (err instanceof framework_base_error_1.FrameworkBaseError) { | ||
if (framework_base_error_1.FrameworkBaseError.isFrameworkError(err)) { | ||
err.message += ` [${this.faqPrefixEnv || this.faqPrefix}/${err.code}]`; | ||
@@ -29,2 +29,2 @@ } | ||
FrameworkErrorFormater.faqPrefixEnv = process.env.EGG_FRAMEWORK_ERR_FAQ_PERFIX; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybWF0dGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZm9ybWF0dGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLGlFQUE0RDtBQUM1RCw2QkFBNkI7QUFDN0IseUJBQXlCO0FBQ3pCLE1BQU0sUUFBUSxHQUFHLEVBQUUsQ0FBQyxRQUFRLEVBQUUsQ0FBQztBQUUvQixNQUFhLHNCQUFzQjtJQUlqQyxNQUFNLENBQUMsTUFBTSxDQUFDLEdBQVU7UUFDdEIsSUFBSSxVQUFVLEdBQUcsR0FBRyxDQUFDLE9BQU8sQ0FBQztRQUM3QixJQUFJLEdBQUcsWUFBWSx5Q0FBa0IsRUFBRTtZQUNyQ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sQ0FBQyxJQUFJLEdBQUcsQ0FBQztTQUN4RTtRQUNELE9BQU8sR0FBRyxDQUFDO0lBQ2IsQ0FBQzs7QUE1Qkgsd0RBNkJDO0FBNUJrQixnQ0FBUyxHQUFHLDZCQUE2QixDQUFDO0FBQzVDLG1DQUFZLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyw0QkFBNEIsQ0FBQyJ9 |
import { EggBaseError, ErrorOptions } from '../'; | ||
export declare const FRAMEWORK_ERROR_SYMBOL: symbol; | ||
export declare class FrameworkBaseError extends EggBaseError<ErrorOptions> { | ||
@@ -7,2 +8,3 @@ readonly serialNumber: string; | ||
constructor(message: string, serialNumber: string | number, errorContext?: any); | ||
static isFrameworkError(err: Error): err is FrameworkBaseError; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FrameworkBaseError = void 0; | ||
exports.FrameworkBaseError = exports.FRAMEWORK_ERROR_SYMBOL = void 0; | ||
const __1 = require("../"); | ||
const assert = require("assert"); | ||
exports.FRAMEWORK_ERROR_SYMBOL = Symbol.for('FrameworkBaseError'); | ||
class FrameworkBaseError extends __1.EggBaseError { | ||
@@ -14,2 +15,3 @@ constructor(message, serialNumber, errorContext) { | ||
this.code = `${this.module}_${this.serialNumber}`; | ||
this[exports.FRAMEWORK_ERROR_SYMBOL] = true; | ||
} | ||
@@ -19,4 +21,7 @@ get module() { | ||
} | ||
static isFrameworkError(err) { | ||
return err[exports.FRAMEWORK_ERROR_SYMBOL] === true; | ||
} | ||
} | ||
exports.FrameworkBaseError = FrameworkBaseError; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJhbWV3b3JrX2Jhc2VfZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJmcmFtZXdvcmtfYmFzZV9lcnJvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwyQkFBaUQ7QUFDakQs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VBQUUsWUFBa0I7UUFDNUUsS0FBSyxDQUFDLEVBQUUsT0FBTyxFQUFFLFlBQVksRUFBRSxZQUFZLEVBQUUsQ0FBQyxDQUFDO1FBQy9DLE1BQU0sQ0FBQyxPQUFPLEVBQUUscUJBQXFCLENBQUMsQ0FBQztRQUN2QyxNQUFNLENBQUMsWUFBWSxFQUFFLDBCQUEwQixDQUFDLENBQUM7UUFFakQsSUFBSSxDQUFDLFlBQVksR0FBRyxNQUFNLENBQUMsWUFBWSxDQUFDLENBQUM7UUFDekMsSUFBSSxDQUFDLFlBQVksR0FBRyxZQUFZLElBQUksRUFBRSxDQUFDO1FBQ3ZDLElBQUksQ0FBQyxJQUFJLEdBQUcsR0FBRyxJQUFJLENBQUMsTUFBTSxJQUFJLElBQUksQ0FBQyxZQUFZLEVBQUUsQ0FBQztRQUVqRCxJQUFZLENBQUMsOEJBQXNCLENBQUMsR0FBRyxJQUFJLENBQUM7SUFDL0MsQ0FBQztJQWRELElBQUksTUFBTTtRQUNSLE1BQU0sSUFBSSxLQUFLLENBQUMsNEJBQTRCLENBQUMsQ0FBQztJQUNoRCxDQUFDO0lBY0QsTUFBTSxDQUFDLGdCQUFnQixDQUFDLEdBQVU7UUFDaEMsT0FBUSxHQUFXLENBQUMsOEJBQXNCLENBQUMsS0FBSyxJQUFJLENBQUM7SUFDdkQsQ0FBQztDQUNGO0FBdkJELGdEQXVCQyJ9 |
{ | ||
"name": "egg-errors", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
93158
1133