This commit is contained in:
seb
2026-10-12 04:05:54 +02:00
parent a2e446af47
commit 4429294d8b
4 changed files with 13 additions and 6 deletions

View File

@@ -43,7 +43,8 @@ function appletExecErrorStatus(error) {
if (message.includes('is not a file')) return 400;
if (message.includes('Applet metadata') || message.includes('Applet input schema') || message.includes('Applet output schema')) return 400;
if (message.includes('Sandbox exceeded')) return 504;
return 500;
if (message.includes('Sandbox worker did not report a result payload')) return 500;
return 400;
}
// #endregion
@@ -163,7 +164,7 @@ export function register(app, basePath = '') {
* truncationNote:
* type: string
* 400:
* description: No company selected, invalid path, not a .applet.js file, invalid input, or invalid applet metadata
* description: No company selected, invalid path, not a .applet.js file, invalid input, invalid applet metadata, or applet runtime error
* content:
* application/json:
* schema:
@@ -187,7 +188,7 @@ export function register(app, basePath = '') {
* schema:
* $ref: '#/components/schemas/Error'
* 500:
* description: The applet threw during execution
* description: Sandbox worker harness failure
* content:
* application/json:
* schema:
@@ -241,6 +242,7 @@ export function register(app, basePath = '') {
return res.status(404).json({ error: 'File not found' });
}
} catch (error) {
res.locals.error = error;
const status = vfsFileErrorStatus(error);
if (status === 500) console.error('Execute vfs applet failed:', error);
return res.status(status).json({ error: error.message });
@@ -258,6 +260,7 @@ export function register(app, basePath = '') {
emit('vfs', { companyId: selected.companyId });
return res.json(result);
} catch (error) {
res.locals.error = error;
const status = appletExecErrorStatus(error);
if (status === 500) console.error('Execute vfs applet failed:', error);
return res.status(status).json({ error: error.message });