[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,8 +134,15 @@ export class BWPanel {
|
||||
),
|
||||
data.value.problemPascalName,
|
||||
data.value.input
|
||||
).then((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;
|
||||
}
|
||||
|
@ -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