mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 05:24:02 +00:00
refac: pyodide worker error handling
This commit is contained in:
parent
78cbdbc63f
commit
066789d423
@ -5,7 +5,7 @@
|
||||
import 'highlight.js/styles/github-dark.min.css';
|
||||
import { loadPyodide } from 'pyodide';
|
||||
import { tick } from 'svelte';
|
||||
import PyodideWorker from '../../../workers/pyodide.worker?worker';
|
||||
import PyodideWorker from '$lib/workers/pyodide.worker?worker';
|
||||
|
||||
export let id = '';
|
||||
|
||||
|
@ -59,7 +59,11 @@ self.onmessage = async (event) => {
|
||||
// make sure loading is done
|
||||
await loadPyodideAndPackages(self.packages);
|
||||
|
||||
self.result = await self.pyodide.runPythonAsync(code);
|
||||
try {
|
||||
self.result = await self.pyodide.runPythonAsync(code);
|
||||
} catch (error) {
|
||||
self.stderr = error.toString();
|
||||
}
|
||||
self.postMessage({ id, result: self.result, stdout: self.stdout, stderr: self.stderr });
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user