FROM : Jens Alfke
DATE : Mon Jun 23 19:24:58 2008
On 23 Jun '08, at 5:21 AM, Mattias Arrelid wrote:
> The error claim that an
> assert has failed in -[NSEvent eventNumber] - and each time this
> occured, our custom mouse tracking seemed to stop working.
> Unfortunately, I do not have access to the log at the moment. What
> would be the right™ thing to do here? Since it isn't an exception, I
> cannot catch it myself, so I'm fumbling in the dark at the moment.
Assertion failures *are* NSExceptions, and you can use an @catch block
to intercept them.
However, they also indicate an error in your code, so of course you
should try to fix the bug instead of just ignoring the exception. The
best thing to do is to use Xcode's breakpoints window to add a
breakpoint at "objc_exception_throw" (on Leopard) or
"NSRaiseError" (Tiger), and run your code with breakpoints on until
you can get the exception to occur. Then you can look at the stack and
your variables to figure out what's wrong.
If it's one of those unpleasant bugs that only manifests when no one's
looking for it, you can build some debugging features into the app. My
MYUtilities library[1] has a module called ExceptionUtils[2] for use
in displaying backtraces of exceptions. You can use this to have any
uncaught exception pop up an alert panel containing the full backtrace.
—Jens
[1] http://mooseyard.com/hg/hgwebdir.cgi/MYUtilities/ ... use the
"zip" link at the top to download
[2] http://mooseyard.com/hg/hgwebdir.cgi/MYUtilities/file/tip/ExceptionUtils.h_______________________________________________
Cocoa-dev mailing list (<email_removed>)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
This email sent to <email_removed>
DATE : Mon Jun 23 19:24:58 2008
On 23 Jun '08, at 5:21 AM, Mattias Arrelid wrote:
> The error claim that an
> assert has failed in -[NSEvent eventNumber] - and each time this
> occured, our custom mouse tracking seemed to stop working.
> Unfortunately, I do not have access to the log at the moment. What
> would be the right™ thing to do here? Since it isn't an exception, I
> cannot catch it myself, so I'm fumbling in the dark at the moment.
Assertion failures *are* NSExceptions, and you can use an @catch block
to intercept them.
However, they also indicate an error in your code, so of course you
should try to fix the bug instead of just ignoring the exception. The
best thing to do is to use Xcode's breakpoints window to add a
breakpoint at "objc_exception_throw" (on Leopard) or
"NSRaiseError" (Tiger), and run your code with breakpoints on until
you can get the exception to occur. Then you can look at the stack and
your variables to figure out what's wrong.
If it's one of those unpleasant bugs that only manifests when no one's
looking for it, you can build some debugging features into the app. My
MYUtilities library[1] has a module called ExceptionUtils[2] for use
in displaying backtraces of exceptions. You can use this to have any
uncaught exception pop up an alert panel containing the full backtrace.
—Jens
[1] http://mooseyard.com/hg/hgwebdir.cgi/MYUtilities/ ... use the
"zip" link at the top to download
[2] http://mooseyard.com/hg/hgwebdir.cgi/MYUtilities/file/tip/ExceptionUtils.h_______________________________________________
Cocoa-dev mailing list (<email_removed>)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Mattias Arrelid | Jun 23, 14:21 | |
| Jens Alfke | Jun 23, 19:24 | |
| Mattias Arrelid | Jun 24, 08:42 |






Cocoa mail archive

