@jamashita/anden-error
Advanced tools
Comparing version 2.2.0 to 2.3.0
import { RuntimeError } from './RuntimeError'; | ||
export declare class Errors<E extends Error> extends RuntimeError<'Errors'> implements Iterable<E> { | ||
readonly noun: 'Errors'; | ||
export declare class Errors<E extends Error> extends RuntimeError implements Iterable<E> { | ||
private readonly errors; | ||
private static getMessage; | ||
static of<ET extends Error>(errors: Iterable<ET>): Errors<ET>; | ||
static ofSpread<ET extends Error>(...errors: ReadonlyArray<ET>): Errors<ET>; | ||
static of<E extends Error>(errors: Iterable<E>): Errors<E>; | ||
static ofSpread<E extends Error>(...errors: ReadonlyArray<E>): Errors<E>; | ||
constructor(errors: ReadonlyArray<E>); | ||
@@ -9,0 +8,0 @@ [Symbol.iterator](): Iterator<E>; |
@@ -9,3 +9,2 @@ "use strict"; | ||
super(Errors.getMessage(errors)); | ||
this.noun = 'Errors'; | ||
this.errors = errors; | ||
@@ -12,0 +11,0 @@ } |
import { RuntimeError } from '../RuntimeError'; | ||
export declare class MockRuntimeError extends RuntimeError<'MockRuntimeError'> { | ||
readonly noun: 'MockRuntimeError'; | ||
export declare class MockRuntimeError extends RuntimeError { | ||
constructor(cause?: Error); | ||
} | ||
//# sourceMappingURL=MockRuntimeError.d.ts.map |
@@ -8,3 +8,2 @@ "use strict"; | ||
super('failed', cause); | ||
this.noun = 'MockRuntimeError'; | ||
} | ||
@@ -11,0 +10,0 @@ } |
@@ -1,5 +0,3 @@ | ||
import { Noun } from '@jamashita/anden-type'; | ||
import { BaseError } from 'make-error-cause'; | ||
export declare abstract class RuntimeError<N extends string = string> extends BaseError implements Noun<N> { | ||
abstract readonly noun: N; | ||
export declare abstract class RuntimeError extends BaseError { | ||
protected constructor(message: string, cause?: Error); | ||
@@ -6,0 +4,0 @@ toString(): string; |
import { RuntimeError } from './RuntimeError'; | ||
export declare class UnimplementedError extends RuntimeError<'UnimplementedError'> { | ||
readonly noun: 'UnimplementedError'; | ||
export declare class UnimplementedError extends RuntimeError { | ||
constructor(message?: string, cause?: Error); | ||
} | ||
//# sourceMappingURL=UnimplementedError.d.ts.map |
@@ -8,3 +8,2 @@ "use strict"; | ||
super(message, cause); | ||
this.noun = 'UnimplementedError'; | ||
} | ||
@@ -11,0 +10,0 @@ } |
import { RuntimeError } from './RuntimeError'; | ||
export declare class Errors<E extends Error> extends RuntimeError<'Errors'> implements Iterable<E> { | ||
readonly noun: 'Errors'; | ||
export declare class Errors<E extends Error> extends RuntimeError implements Iterable<E> { | ||
private readonly errors; | ||
private static getMessage; | ||
static of<ET extends Error>(errors: Iterable<ET>): Errors<ET>; | ||
static ofSpread<ET extends Error>(...errors: ReadonlyArray<ET>): Errors<ET>; | ||
static of<E extends Error>(errors: Iterable<E>): Errors<E>; | ||
static ofSpread<E extends Error>(...errors: ReadonlyArray<E>): Errors<E>; | ||
constructor(errors: ReadonlyArray<E>); | ||
@@ -9,0 +8,0 @@ [Symbol.iterator](): Iterator<E>; |
@@ -6,3 +6,2 @@ import { Kind } from '@jamashita/anden-type'; | ||
super(Errors.getMessage(errors)); | ||
this.noun = 'Errors'; | ||
this.errors = errors; | ||
@@ -9,0 +8,0 @@ } |
import { RuntimeError } from '../RuntimeError'; | ||
export declare class MockRuntimeError extends RuntimeError<'MockRuntimeError'> { | ||
readonly noun: 'MockRuntimeError'; | ||
export declare class MockRuntimeError extends RuntimeError { | ||
constructor(cause?: Error); | ||
} | ||
//# sourceMappingURL=MockRuntimeError.d.ts.map |
@@ -5,5 +5,4 @@ import { RuntimeError } from '../RuntimeError'; | ||
super('failed', cause); | ||
this.noun = 'MockRuntimeError'; | ||
} | ||
} | ||
//# sourceMappingURL=MockRuntimeError.js.map |
@@ -1,5 +0,3 @@ | ||
import { Noun } from '@jamashita/anden-type'; | ||
import { BaseError } from 'make-error-cause'; | ||
export declare abstract class RuntimeError<N extends string = string> extends BaseError implements Noun<N> { | ||
abstract readonly noun: N; | ||
export declare abstract class RuntimeError extends BaseError { | ||
protected constructor(message: string, cause?: Error); | ||
@@ -6,0 +4,0 @@ toString(): string; |
import { RuntimeError } from './RuntimeError'; | ||
export declare class UnimplementedError extends RuntimeError<'UnimplementedError'> { | ||
readonly noun: 'UnimplementedError'; | ||
export declare class UnimplementedError extends RuntimeError { | ||
constructor(message?: string, cause?: Error); | ||
} | ||
//# sourceMappingURL=UnimplementedError.d.ts.map |
@@ -5,5 +5,4 @@ import { RuntimeError } from './RuntimeError'; | ||
super(message, cause); | ||
this.noun = 'UnimplementedError'; | ||
} | ||
} | ||
//# sourceMappingURL=UnimplementedError.js.map |
{ | ||
"name": "@jamashita/anden-error", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"private": false, | ||
@@ -29,3 +29,3 @@ "repository": { | ||
"dependencies": { | ||
"@jamashita/anden-type": "^2.1.2", | ||
"@jamashita/anden-type": "^2.2.0", | ||
"make-error-cause": "2.3.0" | ||
@@ -32,0 +32,0 @@ }, |
import { Ambiguous, Kind } from '@jamashita/anden-type'; | ||
import { RuntimeError } from './RuntimeError'; | ||
export class Errors<E extends Error> extends RuntimeError<'Errors'> implements Iterable<E> { | ||
public readonly noun: 'Errors' = 'Errors'; | ||
export class Errors<E extends Error> extends RuntimeError implements Iterable<E> { | ||
private readonly errors: ReadonlyArray<E>; | ||
private static getMessage<ET extends Error>(errors: ReadonlyArray<ET>): string { | ||
private static getMessage<E extends Error>(errors: ReadonlyArray<E>): string { | ||
return errors.map<string>((error: Error) => { | ||
@@ -14,8 +13,8 @@ return error.message; | ||
public static of<ET extends Error>(errors: Iterable<ET>): Errors<ET> { | ||
return new Errors<ET>([...errors]); | ||
public static of<E extends Error>(errors: Iterable<E>): Errors<E> { | ||
return new Errors<E>([...errors]); | ||
} | ||
public static ofSpread<ET extends Error>(...errors: ReadonlyArray<ET>): Errors<ET> { | ||
return Errors.of<ET>(errors); | ||
public static ofSpread<E extends Error>(...errors: ReadonlyArray<E>): Errors<E> { | ||
return Errors.of<E>(errors); | ||
} | ||
@@ -22,0 +21,0 @@ |
import { RuntimeError } from '../RuntimeError'; | ||
export class MockRuntimeError extends RuntimeError<'MockRuntimeError'> { | ||
public readonly noun: 'MockRuntimeError' = 'MockRuntimeError'; | ||
export class MockRuntimeError extends RuntimeError { | ||
public constructor(cause?: Error) { | ||
@@ -7,0 +5,0 @@ super('failed', cause); |
@@ -1,7 +0,4 @@ | ||
import { Noun } from '@jamashita/anden-type'; | ||
import { BaseError, fullStack } from 'make-error-cause'; | ||
export abstract class RuntimeError<N extends string = string> extends BaseError implements Noun<N> { | ||
public abstract readonly noun: N; | ||
export abstract class RuntimeError extends BaseError { | ||
protected constructor(message: string, cause?: Error) { | ||
@@ -8,0 +5,0 @@ super(message, cause); |
import { RuntimeError } from './RuntimeError'; | ||
export class UnimplementedError extends RuntimeError<'UnimplementedError'> { | ||
public readonly noun: 'UnimplementedError' = 'UnimplementedError'; | ||
export class UnimplementedError extends RuntimeError { | ||
public constructor(message: string = 'UNIMPLEMENTED', cause?: Error) { | ||
@@ -7,0 +5,0 @@ super(message, cause); |
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
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
64880
293
Updated@jamashita/anden-type@^2.2.0