mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 11:15:36 -05:00
[next] Follow up on stderr (#1683)
This commit is contained in:
committed by
GitHub
parent
0696e4682d
commit
fd60b4789a
4
pyscript.core/package-lock.json
generated
4
pyscript.core/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@pyscript/core",
|
"name": "@pyscript/core",
|
||||||
"version": "0.1.9",
|
"version": "0.1.10",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pyscript/core",
|
"name": "@pyscript/core",
|
||||||
"version": "0.1.9",
|
"version": "0.1.10",
|
||||||
"license": "APACHE-2.0",
|
"license": "APACHE-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ungap/with-resolvers": "^0.1.0",
|
"@ungap/with-resolvers": "^0.1.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pyscript/core",
|
"name": "@pyscript/core",
|
||||||
"version": "0.1.9",
|
"version": "0.1.10",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "PyScript",
|
"description": "PyScript",
|
||||||
"module": "./dist/core.js",
|
"module": "./dist/core.js",
|
||||||
|
|||||||
@@ -9,13 +9,10 @@ hooks.onBeforeRun.add(function override(pyScript) {
|
|||||||
const { stderr } = pyScript.io;
|
const { stderr } = pyScript.io;
|
||||||
|
|
||||||
// override it with our own logic
|
// override it with our own logic
|
||||||
pyScript.io.stderr = (...args) => {
|
pyScript.io.stderr = (error, ...rest) => {
|
||||||
// grab the message of the first argument (Error)
|
notify(error.message || error);
|
||||||
const [{ message }] = args;
|
// let other plugins or stderr hook, if any, do the rest
|
||||||
// show it
|
return stderr(error, ...rest);
|
||||||
notify(message);
|
|
||||||
// still let other plugins or PyScript itself do the rest
|
|
||||||
return stderr(...args);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// be sure uncaught Python errors are also visible
|
// be sure uncaught Python errors are also visible
|
||||||
|
|||||||
Reference in New Issue
Block a user