[next] Follow up on stderr (#1683)

This commit is contained in:
Andrea Giammarchi
2023-09-08 09:55:27 +02:00
committed by GitHub
parent 0696e4682d
commit fd60b4789a
3 changed files with 7 additions and 10 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@pyscript/core",
"version": "0.1.9",
"version": "0.1.10",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@pyscript/core",
"version": "0.1.9",
"version": "0.1.10",
"license": "APACHE-2.0",
"dependencies": {
"@ungap/with-resolvers": "^0.1.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@pyscript/core",
"version": "0.1.9",
"version": "0.1.10",
"type": "module",
"description": "PyScript",
"module": "./dist/core.js",

View File

@@ -9,13 +9,10 @@ hooks.onBeforeRun.add(function override(pyScript) {
const { stderr } = pyScript.io;
// override it with our own logic
pyScript.io.stderr = (...args) => {
// grab the message of the first argument (Error)
const [{ message }] = args;
// show it
notify(message);
// still let other plugins or PyScript itself do the rest
return stderr(...args);
pyScript.io.stderr = (error, ...rest) => {
notify(error.message || error);
// let other plugins or stderr hook, if any, do the rest
return stderr(error, ...rest);
};
// be sure uncaught Python errors are also visible