-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSBridge-Core-ct.11: Fix superclass of JSException #155
base: main
Are you sure you want to change the base?
Conversation
One should (always) never subclass from Exception itself, but most of the time from Error or Notification or one of its subclasses. Exception is an abstract class, and the previous implementation led to SubclassResponsibility errors from Exception>>defaultAction when signaling a JSException. Since JavaScript errors do not have Smalltalk''s coroutine capabilities, subclassing from Error seems a perfect match in this case.
Interesting, thanks! Could you please also update JSBridge.st which is used by pre-Monticello images? And while you're at it, I think we should update
|
In Squeak/Smalltalk, one can implement dynamic scope through
...if one means to model exceptions in a somewhat traditional sense. Yes. In Squeak, there are "notifications in disguise" (i.e., resumable exceptions) such as |
@codefrau Sorry for the delay! Yes, your fix works in the mini image. I prefer to add this to the beginning of self class superclass ifNil: [^ nil error: error asString]. Other than that, I think I found a few more issues: SqueakJS does not support custom error valuesThe ECMA specs do not require values that are passed to
|
I like your analysis! I agree we should wrap thrown objects in For historical context: Re: Re: "SqueakJS GUI does not support promises" – works on my machine 😉 I'm not worried about |
@codefrau Sorry for not replying earlier! While trying to debug Just some very brief replies below:
Thanks! Looking forward to integrate them on the image side soon if you do not preempt me. :-)
I like that!
It works on the demo page for me too, but not on https://squeak.js.org/run. Do they share the same GUI code?
|
Yes, the GUI is created by createSqueakDisplay which is shared by all pages. Only when running on Lively there is different GUI code. After running the demo, you should find "squeakjs.image" on the /run page. Clicking that works just fine for me. |
One should (always) never subclass from Exception itself, but most of the time from Error or Notification or one of its subclasses. Exception is an abstract class, and the previous implementation led to SubclassResponsibility errors from Exception>>defaultAction when signaling a JSException. Since JavaScript errors do not have Smalltalk''s coroutine capabilities, subclassing from Error seems a perfect match in this case.