#264 closed defect (fixed)
dojo.raise() calls println() even when exception is caught
Reported by: | Owned by: | Adam Peller | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Core | Version: | 0.2 |
Keywords: | Cc: | [email protected]… | |
Blocked By: | Blocking: |
Description
dojo.raise() always calls dojo.hostenv.println("FATAL"), regardless of whether the exception is caught and squelched.
For example, if you do this, you still get a "FATAL" message:
try { dojo.raise("wanh"); } catch (e) { tryAgian = true; // not fatal, so we squelch }
Would it be better to do the println("FATAL") call in some top level error handler? For example, if dojo is running in a browser, it could set window.onerror=dojo.errorHandler(), which should only get called if the exception has not been caught and squelched.
Change History (7)
comment:1 Changed 15 years ago by
Owner: | changed from anonymous to skinner |
---|
comment:2 Changed 15 years ago by
Milestone: | 0.3release → 0.4 |
---|
comment:3 Changed 14 years ago by
Owner: | changed from skinner to Adam Peller |
---|
comment:4 Changed 14 years ago by
comment:5 Changed 14 years ago by
Cc: | [email protected]… added; Brian Douglas Skinner <[email protected]…> removed |
---|
What about having some config variable that allows somebody to optionally turn off that println("FATAL")?
djConfig.verboseExceptions = false;
That would make it possible to squelch bogus FATAL messages in some scenarios, while still not messing up people who rely on the println("FATAL") being there.
Or, maybe another option is to just use the existing djConfig.isDebug...
dojo.raise = function(/*String*/ message, /*Error?*/ exception){ if(exception){ message = message + ": "+dojo.errorToString(exception); } if (djConfig.isDebug) { try { dojo.hostenv.println("FATAL: "+message); } catch (e) {} } throw Error(message); }
comment:6 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
The proposed solution will not be precise, as a caught exception may still get reported later if an onerror condition occurs; the exception report will be stale. In some ways this is an improvement over reporting the exception always when it is caught, though the timing will be off, further complicating debugging.
The only other solution I can think of, besides WONTFIX, is to change the println to indicate "FATAL exception raised" so it's not as misleading.