Skip to content

Commit 9ef60c1

Browse files
authored
Make GitHub import errors more descriptive (codesandbox#3430)
* Make GitHub import (and other?) errors more descriptive. * Check if GitHub import.
1 parent f2f3c22 commit 9ef60c1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/app/src/app/overmind/namespaces/editor/actions.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ export const sandboxChanged: AsyncAction<{ id: string }> = withLoadApp<{
100100
actions.workspace.openDefaultItem();
101101
} catch (error) {
102102
state.editor.notFound = true;
103-
state.editor.error = error.message;
103+
let detail = error.response?.data?.errors?.detail;
104+
if (Array.isArray(detail)) {
105+
detail = detail[0];
106+
}
107+
state.editor.error = detail || error.message;
104108
state.editor.isLoading = false;
105109
return;
106110
}

packages/app/src/app/pages/Sandbox/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const Sandbox: React.FC<Props> = ({ match }) => {
7777
Something went wrong
7878
</div>
7979
<Title style={{ fontSize: '1.25rem', marginBottom: 0 }}>
80+
{isGithub ? 'Error importing GitHub repository: ' : ''}
8081
{state.editor.error}
8182
</Title>
8283
<br />

0 commit comments

Comments
 (0)