mirror of
https://github.com/micropython/micropython.git
synced 2025-09-07 02:10:52 +02:00
The `reason` in a rejected promise should be an instance of `Error`. That leads to better error messages on the JavaScript side. Signed-off-by: Damien George <damien@micropython.org>
12 lines
358 B
JavaScript
12 lines
358 B
JavaScript
// Test raising an exception in async Python code running in runPythonAsync,
|
|
// that the JavaScript-level promise is rejected with a PythonError.
|
|
|
|
const mp = await (await import(process.argv[2])).loadMicroPython();
|
|
|
|
try {
|
|
await mp.runPythonAsync("await fail");
|
|
} catch (error) {
|
|
console.log(error.name, error.type);
|
|
console.log(error.message);
|
|
}
|