mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
Add functions for v1.10 (#16281)
- VError.hasCauseWithName - VError.errorFromList - VError.errorForEach
This commit is contained in:
Vendored
+5
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for verror 1.9
|
||||
// Type definitions for verror 1.10
|
||||
// Project: https://github.com/davepacheco/node-verror
|
||||
// Definitions by: Sven Reglitzki <https://github.com/svi3c/>, Maxime Toumi-M <https://github.com/max4t/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -22,8 +22,11 @@ declare class VError extends Error {
|
||||
|
||||
static cause(err: Error): Error | null;
|
||||
static info(err: Error): VError.Info;
|
||||
static findCauseByName(err: Error, name: string): Error | null;
|
||||
static fullStack(err: Error): string;
|
||||
static findCauseByName(err: Error, name: string): Error | null;
|
||||
static hasCauseWithName(err: Error, name: string): boolean;
|
||||
static errorFromList<T extends Error>(errors: T[]): null | T | VError.MultiError;
|
||||
static errorForEach(err: Error, func: (err: Error) => void): void;
|
||||
|
||||
cause(): Error | undefined;
|
||||
constructor(options: VError.Options | Error, message: string, ...params: any[]);
|
||||
|
||||
@@ -25,3 +25,12 @@ const info: { [k: string]: any } = VError.info(verror3);
|
||||
const namedCause: Error | null = VError.findCauseByName(verror3, "fooError");
|
||||
const stack: string = VError.fullStack(verror3);
|
||||
const cause3: Error | null = VError.cause(verror3);
|
||||
|
||||
// Added in v1.9
|
||||
const hasCause: boolean = VError.hasCauseWithName(error, "name");
|
||||
|
||||
// Added in v1.10
|
||||
const toList1: null|VError|MultiError = VError.errorFromList([verror1]);
|
||||
const toList2: null|Error|MultiError = VError.errorFromList([error, verror1]);
|
||||
|
||||
VError.errorForEach(multiError, (error: Error) => {});
|
||||
|
||||
Reference in New Issue
Block a user