-
-
Notifications
You must be signed in to change notification settings - Fork 671
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
Control flow with exceptions #6754
Comments
Hmm, it shouldn't use What exactly is the issue there? |
I had a stack overflow error when returning a complex expression in hscript. I fixed it with HaxeFoundation/hscript@8c04831 |
Try running the following on Node: class Main {
static function main() {
try {
var m = new Map<String,Dynamic>();
m.set("recurse",m);
throw m;
} catch( e : String ) {
trace("CAUGHT string ?");
}
}
} it seems |
Right, custom |
triggering toString when throwing is bad for performance anyway.
Can't we add it in Error.toString() so it's only triggered if we print the
exception itself ?
…On Sat, Nov 25, 2017 at 12:43 PM, Dan Korostelev ***@***.***> wrote:
Right, custom toString... The problem here is that we want to fill some
message for thrown errors or they'll be incomprehensible and doing
String(val) sounds like the best thing we can do. Gotta think about it,
but right now I'm thinking that maybe it's more of a Map issue.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6754 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-bwCTEJWyi9UvCpJPArUSyOEFJAdwGks5s5_1_gaJpZM4QpuKH>
.
|
There should be some way, |
Yes, that would work too and be more backward compatible
…On Sat, Nov 25, 2017 at 9:19 PM, Dan Korostelev ***@***.***> wrote:
There should be *some* way, toString or maybe a js getter for the message
property, gotta look into it...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6754 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-bwIBF94NPjcFAlh35Gj9rI7qcx9LVks5s6HZVgaJpZM4QpuKH>
.
|
It is a often used principle in FP to use exceptions for control flow.
These exceptions can hold complex values that should not be stringified (they might have recursive values loops)
Or I noticed that's exactly what js.HaxeError does.... it Std.string the exception value when the exception is created...
Could this be avoided ?
I had to change hscript implementation that was throwing exception in the form or
throw SReturn(value)
because of the bugs it produces.Maybe the recent PR #6713 also causes some regression here, by using Std.string instead of String(value) ping @nadako
The text was updated successfully, but these errors were encountered: