Skip to content

Commit 9c1485b

Browse files
Update src/deepnote-content-provider.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 87d62f6 commit 9c1485b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/deepnote-content-provider.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,21 @@ export class DeepnoteContentProvider extends RestContentProvider {
1717
}
1818

1919
// Call custom API route to fetch the Deepnote file content
20-
const data = await requestAPI<any>(`file?path=${localPath}`);
21-
const modelData = data.deepnoteFileModel;
20+
// Call custom API route to fetch the Deepnote file content
21+
- const data = await requestAPI<any>(`file?path=${localPath}`);
22+
let data: any;
23+
try {
24+
data = await requestAPI<any>(`file?path=${encodeURIComponent(localPath)}`);
25+
} catch (error) {
26+
console.error(`Failed to fetch Deepnote file: ${localPath}`, error);
27+
throw new Error(`Failed to fetch .deepnote file: ${error}`);
28+
}
29+
30+
if (!data.deepnoteFileModel) {
31+
throw new Error(`Invalid API response: missing deepnoteFileModel for ${localPath}`);
32+
}
33+
34+
const modelData = data.deepnoteFileModel;
2235

2336
// Transform the Deepnote YAML to Jupyter notebook content
2437
const notebookContent = await transformDeepnoteYamlToNotebookContent(

0 commit comments

Comments
 (0)