@naturalcycles/js-lib
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -0,1 +1,8 @@ | ||
## [2.2.2](https://github.com/NaturalCycles/js-lib/compare/v2.2.1...v2.2.2) (2019-02-22) | ||
### Bug Fixes | ||
* err instanceof AppError, err instanceof Error ([19022ef](https://github.com/NaturalCycles/js-lib/commit/19022ef)) | ||
## [2.2.1](https://github.com/NaturalCycles/js-lib/compare/v2.2.0...v2.2.1) (2019-02-22) | ||
@@ -2,0 +9,0 @@ |
@@ -7,2 +7,4 @@ /** | ||
* data.userMessage - if present, will be displayed to the User as is. | ||
* | ||
* Based on: https://medium.com/@xpl/javascript-deriving-from-error-properly-8d2f8f315801 | ||
*/ | ||
@@ -13,5 +15,6 @@ export class AppError extends Error { | ||
this.data = data; | ||
this.constructor = AppError; | ||
this.__proto__ = AppError.prototype; | ||
Object.defineProperty(this, 'name', { | ||
// value: this.constructor.name, | ||
value: 'AppError', | ||
value: this.constructor.name, | ||
configurable: true, | ||
@@ -18,0 +21,0 @@ }); |
@@ -8,5 +8,6 @@ import { AppError } from './app.error'; | ||
super(message, Object.assign({ httpStatusCode: 500 }, data)); | ||
this.constructor = HttpError; | ||
this.__proto__ = HttpError.prototype; | ||
Object.defineProperty(this, 'name', { | ||
// value: this.constructor.name, | ||
value: 'HttpError', | ||
value: this.constructor.name, | ||
configurable: true, | ||
@@ -13,0 +14,0 @@ }); |
@@ -8,2 +8,4 @@ import { ErrorData } from './error.model'; | ||
* data.userMessage - if present, will be displayed to the User as is. | ||
* | ||
* Based on: https://medium.com/@xpl/javascript-deriving-from-error-properly-8d2f8f315801 | ||
*/ | ||
@@ -10,0 +12,0 @@ export declare class AppError<DATA_TYPE extends ErrorData = ErrorData> extends Error { |
@@ -9,2 +9,4 @@ "use strict"; | ||
* data.userMessage - if present, will be displayed to the User as is. | ||
* | ||
* Based on: https://medium.com/@xpl/javascript-deriving-from-error-properly-8d2f8f315801 | ||
*/ | ||
@@ -15,5 +17,6 @@ class AppError extends Error { | ||
this.data = data; | ||
this.constructor = AppError; | ||
this.__proto__ = AppError.prototype; | ||
Object.defineProperty(this, 'name', { | ||
// value: this.constructor.name, | ||
value: 'AppError', | ||
value: this.constructor.name, | ||
configurable: true, | ||
@@ -20,0 +23,0 @@ }); |
@@ -10,5 +10,6 @@ "use strict"; | ||
super(message, Object.assign({ httpStatusCode: 500 }, data)); | ||
this.constructor = HttpError; | ||
this.__proto__ = HttpError.prototype; | ||
Object.defineProperty(this, 'name', { | ||
// value: this.constructor.name, | ||
value: 'HttpError', | ||
value: this.constructor.name, | ||
configurable: true, | ||
@@ -15,0 +16,0 @@ }); |
{ | ||
"name": "@naturalcycles/js-lib", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "del ./dist && tsc", |
@@ -9,2 +9,4 @@ import { ErrorData } from './error.model' | ||
* data.userMessage - if present, will be displayed to the User as is. | ||
* | ||
* Based on: https://medium.com/@xpl/javascript-deriving-from-error-properly-8d2f8f315801 | ||
*/ | ||
@@ -15,5 +17,6 @@ export class AppError<DATA_TYPE extends ErrorData = ErrorData> extends Error { | ||
this.constructor = AppError | ||
;(this as any).__proto__ = AppError.prototype | ||
Object.defineProperty(this, 'name', { | ||
// value: this.constructor.name, | ||
value: 'AppError', | ||
value: this.constructor.name, | ||
configurable: true, | ||
@@ -20,0 +23,0 @@ }) |
@@ -14,5 +14,6 @@ import { AppError } from './app.error' | ||
this.constructor = HttpError | ||
;(this as any).__proto__ = HttpError.prototype | ||
Object.defineProperty(this, 'name', { | ||
// value: this.constructor.name, | ||
value: 'HttpError', | ||
value: this.constructor.name, | ||
configurable: true, // otherwise throws with "TypeError: Cannot redefine property: name" | ||
@@ -19,0 +20,0 @@ }) |
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
104105
1850