On 2/15/07, Rush Manbert <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> In my loadJSONDoc() callback I called a object constructor with an
> incorrect argument list. The constructor detected this. Had I been
> writing this in C++ (ignoring the fact that you can't call a function
> with the wrong argument list because of compiler type checking), I would
> have put this at the place where I detected the error:
>
>      assert (0 == "MyCollection: Called with bad argument list!");
>
> Instead, I did this:
>
>      throw Error("MyCollection: Called with bad argument list!");
>
> which was caught by the Deferred. When I added an errback, it was called
> with the error. Just for testing, I ran an alert, then re-threw the
> error. But the Deferred caught that too, and it just disappeared.
>
> This case is a programming error that can't (shouldn't) be recovered
> from. What I really wanted was an assert, but was willing to settle for
> an uncaught exception that would bubble up to my app. (This is occurring
> in a WebView on a Mac).
>
> Is there any way to make this happen? Is there something better to do?
> In JavaScript, this seems like sort of a generic problem (functions can
> be called with incorrect arguments) that needs to be handled in general.

There is no way to make that happen. The last errback is all you're
going to get. It's not possible to know if a Deferred chain is
finished or not until it gets garbage collected, and there's no way in
JavaScript to get notified on object destruction.

-bob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to