Skip to content

Commit 01876d6

Browse files
committed
move DrivesResponseError class
1 parent f036cf8 commit 01876d6

File tree

2 files changed

+34
-36
lines changed

2 files changed

+34
-36
lines changed

src/drivesError.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/handler.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { URLExt } from '@jupyterlab/coreutils';
22
import { ServerConnection } from '@jupyterlab/services';
33
import { ReadonlyJSONObject } from '@lumino/coreutils';
44

5-
import { DrivesResponseError } from './drivesError';
5+
// import { DrivesResponseError } from './drivesError';
66

77
/**
88
* Array of Jupyter Drives Auth Error Messages.
@@ -15,6 +15,39 @@ export const AUTH_ERROR_MESSAGES = [
1515
'Authentication error'
1616
];
1717

18+
/**
19+
* A wrapped error for a fetch response.
20+
*/
21+
export class DrivesResponseError extends ServerConnection.ResponseError {
22+
/**
23+
* Create a new response error.
24+
*/
25+
constructor(
26+
response: Response,
27+
message = `Invalid response: ${response.status} ${response.statusText}`,
28+
traceback = '',
29+
json: ReadonlyJSONObject | null = {}
30+
) {
31+
super(response, message);
32+
this.traceback = traceback; // traceback added in mother class in 2.2.x
33+
this._json = json ?? {};
34+
}
35+
36+
/**
37+
* The error response JSON body
38+
*/
39+
get json(): ReadonlyJSONObject {
40+
return this._json;
41+
}
42+
43+
/**
44+
* The traceback associated with the error.
45+
*/
46+
traceback: string;
47+
48+
protected _json: ReadonlyJSONObject;
49+
}
50+
1851
/**
1952
* Call the API extension
2053
*

0 commit comments

Comments
 (0)