[extension] Better error when submitting
This commit is contained in:
parent
7df32c63d1
commit
05761d811e
@ -104,9 +104,8 @@ export class BWPanel {
|
||||
data.value.teamId,
|
||||
data.value.problemId
|
||||
);
|
||||
} catch (reason) {
|
||||
vscode.window.showErrorMessage('Unable to submit');
|
||||
console.error(reason);
|
||||
} catch (err: any) {
|
||||
vscode.window.showErrorMessage(err.message ?? 'Submission unsuccessful');
|
||||
break;
|
||||
}
|
||||
vscode.window.showInformationMessage('Submitted!');
|
||||
@ -135,9 +134,16 @@ export class BWPanel {
|
||||
),
|
||||
data.value.problemPascalName,
|
||||
data.value.input
|
||||
).then((output) => {
|
||||
this._panel.webview.postMessage({ type: 'onOutput', value: output });
|
||||
});
|
||||
)
|
||||
.then((output) => {
|
||||
this._panel.webview.postMessage({ type: 'onOutput', value: output });
|
||||
})
|
||||
.catch(() => {
|
||||
this._panel.webview.postMessage({
|
||||
type: 'onOutput',
|
||||
value: '[An error occurred while running]'
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'onStartup': {
|
||||
|
@ -58,6 +58,6 @@ export async function submitProblem(
|
||||
throw Error('Failed to post submission');
|
||||
}
|
||||
if (!res.data.success) {
|
||||
throw Error('Submission post unsuccessful');
|
||||
throw Error(res.data.message ?? 'Unknown error');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user