Skip to content

Commit 852a438

Browse files
committed
update logic to retrieve drives list
1 parent 66238b3 commit 852a438

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

src/contents.ts

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -246,30 +246,37 @@ export class Drive implements Contents.IDrive {
246246
} else {
247247
// retriving list of contents from root
248248
// in our case: list available drives
249-
const drivesList: Contents.IModel[] = [];
249+
const drivesListInfo: Contents.IModel[] = [];
250250
// fetch list of available drives
251-
this._drivesList = await getDrivesList();
252-
for (const drive of this._drivesList) {
253-
drivesList.push({
254-
name: drive.name,
255-
path: drive.name,
256-
last_modified: '',
257-
created: drive.creationDate,
258-
content: [],
259-
format: 'json',
260-
mimetype: '',
261-
size: undefined,
262-
writable: true,
263-
type: 'directory'
264-
});
251+
try {
252+
this._drivesList = await getDrivesList();
253+
for (const drive of this._drivesList) {
254+
drivesListInfo.push({
255+
name: drive.name,
256+
path: drive.name,
257+
last_modified: '',
258+
created: drive.creationDate,
259+
content: [],
260+
format: 'json',
261+
mimetype: '',
262+
size: undefined,
263+
writable: true,
264+
type: 'directory'
265+
});
266+
}
267+
} catch (error) {
268+
console.log(
269+
'Failed loading available drives list, with error: ',
270+
error
271+
);
265272
}
266273

267274
data = {
268275
name: this._name,
269276
path: this._name,
270277
last_modified: '',
271278
created: '',
272-
content: drivesList,
279+
content: drivesListInfo,
273280
format: 'json',
274281
mimetype: '',
275282
size: undefined,

0 commit comments

Comments
 (0)