@betterer/errors
Advanced tools
Comparing version 4.0.0 to 5.0.0
@@ -6,2 +6,10 @@ # Change Log | ||
# [5.0.0](https://github.com/phenomnomnominal/betterer/compare/v4.4.1...v5.0.0) (2021-11-12) | ||
**Note:** Version bump only for package @betterer/errors | ||
# [4.0.0](https://github.com/phenomnomnominal/betterer/compare/v3.1.2...v4.0.0) (2021-02-27) | ||
@@ -8,0 +16,0 @@ |
import { BettererErrorDetails } from './types'; | ||
/** | ||
* @public A custom Error for use in **Betterer**. It attaches some extra details to a standard | ||
* JavaScript error for better logging and debugging. | ||
* | ||
* @param message - The error message. | ||
* @param details - Extra details for the error. | ||
*/ | ||
export declare class BettererError extends Error { | ||
/** | ||
* Extra details for the error. | ||
*/ | ||
details: BettererErrorDetails; | ||
/** | ||
* Used by {@link @betterer/errors#isBettererError | `isBettererError()`} to detect that an | ||
* object is an instance of `BettererError`. | ||
*/ | ||
isBettererError: boolean; | ||
constructor(message: string, ...details: BettererErrorDetails); | ||
} | ||
/** | ||
* @public Check if an object is a {@link BettererError | `BettererError`}. | ||
* | ||
* @example | ||
* ```typescript | ||
* import { BettererError, isBettererError } from '@betterer/errors'; | ||
* | ||
* isBettererError(new Error()); // false | ||
* isBettererError(new BettererError()); // true | ||
* ``` | ||
*/ | ||
export declare function isBettererError(err: unknown): err is BettererError; | ||
//# sourceMappingURL=error.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isBettererError = exports.BettererError = void 0; | ||
/** | ||
* @public A custom Error for use in **Betterer**. It attaches some extra details to a standard | ||
* JavaScript error for better logging and debugging. | ||
* | ||
* @param message - The error message. | ||
* @param details - Extra details for the error. | ||
*/ | ||
class BettererError extends Error { | ||
constructor(message, ...details) { | ||
super(message); | ||
/** | ||
* Used by {@link @betterer/errors#isBettererError | `isBettererError()`} to detect that an | ||
* object is an instance of `BettererError`. | ||
*/ | ||
this.isBettererError = true; | ||
@@ -14,2 +25,13 @@ Error.captureStackTrace(this, BettererError); | ||
exports.BettererError = BettererError; | ||
/** | ||
* @public Check if an object is a {@link BettererError | `BettererError`}. | ||
* | ||
* @example | ||
* ```typescript | ||
* import { BettererError, isBettererError } from '@betterer/errors'; | ||
* | ||
* isBettererError(new Error()); // false | ||
* isBettererError(new BettererError()); // true | ||
* ``` | ||
*/ | ||
function isBettererError(err) { | ||
@@ -16,0 +38,0 @@ return !!err.isBettererError; |
@@ -0,2 +1,8 @@ | ||
/** | ||
* Error type used within {@link https://github.com/phenomnomnominal/betterer | **Betterer**}. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
export { BettererError, isBettererError } from './error'; | ||
export { BettererErrorDetail, BettererErrorDetails } from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
/** | ||
* Error type used within {@link https://github.com/phenomnomnominal/betterer | **Betterer**}. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +8,0 @@ exports.isBettererError = exports.BettererError = void 0; |
import { BettererError } from './error'; | ||
/** | ||
* @public An additional piece of information attached to a {@link BettererError | `BettererError`}. | ||
* This might be a more detailed error message, or the original Error that caused the | ||
* {@link BettererError | `BettererError`} to be created. | ||
*/ | ||
export declare type BettererErrorDetail = string | Error | BettererError; | ||
/** | ||
* @public A list of {@link BettererErrorDetail | `BettererErrorDetail`s }. | ||
*/ | ||
export declare type BettererErrorDetails = ReadonlyArray<BettererErrorDetail>; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@betterer/errors", | ||
"description": "error handler for @betterer/betterer", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"license": "MIT", | ||
@@ -25,3 +25,3 @@ "publishConfig": { | ||
"compile": "tsc -b .", | ||
"api": "ts-api-guardian --out ../../goldens/api/@betterer/errors.d.ts dist/index.d.ts" | ||
"api": "api-extractor run --local --verbose" | ||
}, | ||
@@ -31,3 +31,3 @@ "engines": { | ||
}, | ||
"gitHead": "e4068ade2596567bc53c6486280af3d882b40aa7" | ||
"gitHead": "2a19f45ea49f8df4b53e3608216253d25e1ad047" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
16860
17
113