mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
[@types/node-fetch] Fix FetchError class definition (#40581)
* Fix FetchError class definition * Add myself to "Definitions by" section of package header
This commit is contained in:
committed by
Sheetal Nandi
parent
eaf62c8120
commit
c5687bab45
Vendored
+6
-1
@@ -9,6 +9,7 @@
|
||||
// Brandon Wilson <https://github.com/wilsonianb>
|
||||
// Steve Faulkner <https://github.com/southpolesteve>
|
||||
// ExE Boss <https://github.com/ExE-Boss>
|
||||
// Alex Savin <https://github.com/alexandrusavin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -148,9 +149,13 @@ export class Body {
|
||||
timeout: number;
|
||||
}
|
||||
|
||||
interface SystemError extends Error {
|
||||
code?: string;
|
||||
}
|
||||
|
||||
export class FetchError extends Error {
|
||||
name: "FetchError";
|
||||
constructor(message: string, type: string, systemError?: string);
|
||||
constructor(message: string, type: string, systemError?: SystemError);
|
||||
type: string;
|
||||
code?: string;
|
||||
errno?: string;
|
||||
|
||||
@@ -158,7 +158,15 @@ function test_isRedirect() {
|
||||
}
|
||||
|
||||
function test_FetchError() {
|
||||
new FetchError("message", "type", "systemError");
|
||||
new FetchError("message", "type", {
|
||||
name: 'Error',
|
||||
message: 'Error message',
|
||||
code: "systemError",
|
||||
});
|
||||
new FetchError("message", "type", {
|
||||
name: 'Error',
|
||||
message: "Error without code",
|
||||
});
|
||||
new FetchError("message", "type");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user