Skip to content

Commit 689036e

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

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/deepnote-content-provider.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,23 @@ 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}`);
20+
let data: any;
21+
22+
try {
23+
data = await requestAPI<any>(
24+
`file?path=${encodeURIComponent(localPath)}`
25+
);
26+
} catch (error) {
27+
console.error(`Failed to fetch Deepnote file: ${localPath}`, error);
28+
throw new Error(`Failed to fetch .deepnote file: ${error}`);
29+
}
30+
31+
if (!data.deepnoteFileModel) {
32+
throw new Error(
33+
`Invalid API response: missing deepnoteFileModel for ${localPath}`
34+
);
35+
}
36+
2137
const modelData = data.deepnoteFileModel;
2238

2339
// Transform the Deepnote YAML to Jupyter notebook content

0 commit comments

Comments
 (0)