[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.teamId,
|
||||||
data.value.problemId
|
data.value.problemId
|
||||||
);
|
);
|
||||||
} catch (reason) {
|
} catch (err: any) {
|
||||||
vscode.window.showErrorMessage('Unable to submit');
|
vscode.window.showErrorMessage(err.message ?? 'Submission unsuccessful');
|
||||||
console.error(reason);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
vscode.window.showInformationMessage('Submitted!');
|
vscode.window.showInformationMessage('Submitted!');
|
||||||
@ -135,9 +134,16 @@ export class BWPanel {
|
|||||||
),
|
),
|
||||||
data.value.problemPascalName,
|
data.value.problemPascalName,
|
||||||
data.value.input
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case 'onStartup': {
|
case 'onStartup': {
|
||||||
|
@ -58,6 +58,6 @@ export async function submitProblem(
|
|||||||
throw Error('Failed to post submission');
|
throw Error('Failed to post submission');
|
||||||
}
|
}
|
||||||
if (!res.data.success) {
|
if (!res.data.success) {
|
||||||
throw Error('Submission post unsuccessful');
|
throw Error(res.data.message ?? 'Unknown error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user