Skip to content

Commit f8555cd

Browse files
committed
iterate on listing drives plugin
1 parent d728968 commit f8555cd

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

jupyter_drives/managers/s3.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ async def list_drives(self):
6868
}
6969
else:
7070
response = {"code": 400, "message": "No AWS credentials specified. Please set them in your user jupyter_server_config file."}
71-
71+
raise tornado.web.HTTPError(
72+
status_code= httpx.codes.BAD_REQUEST,
73+
reason="No AWS credentials specified. Please set them in your user jupyter_server_config file.",
74+
)
75+
7276
return response
7377

7478
async def mount_drive(self, drive_name):

src/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,8 @@ const drivesListProvider: JupyterFrontEndPlugin<IDriveInfo[]> = {
161161
provides: IDrivesList,
162162
activate: async (_: JupyterFrontEnd): Promise<IDriveInfo[]> => {
163163
const drives: IDriveInfo[] = [];
164-
165-
const response = await getDrivesList();
166-
if (response.code === 200) {
164+
try {
165+
const response = await getDrivesList();
167166
for (const drive of response.data) {
168167
drives.push({
169168
name: drive.name,
@@ -172,8 +171,8 @@ const drivesListProvider: JupyterFrontEndPlugin<IDriveInfo[]> = {
172171
creationDate: drive.creation_date
173172
});
174173
}
175-
} else {
176-
console.log(response.message);
174+
} catch {
175+
console.log('Failed loading available drives list.');
177176
}
178177
return drives;
179178
}

0 commit comments

Comments
 (0)