Reporting errors from key-value-coding accessors
Reporting errors from key-value-coding accessors
- Subject: Reporting errors from key-value-coding accessors
- From: Mark Alldritt <email@hidden>
- Date: Fri, 19 Aug 2005 11:10:34 -0700
Hi,
In my application I have a long list of KVC accessor functions that need to
potentially report errors. If the accessor is called from bindings, I'm not
at all sure how to report an error. When the accessor is called from Cocoa
Scripting, I have to alter the calling event's reply. If the accessor is
invoked from UI code, I need to display a sheet/panel explaining the error.
If the accessor is called from some other KVC client code, I have no idea
what to do.
While many of my accessors return objects, and so can return nil, many
others return BOOL or integer results. In these cases, its not possible to
report an error through the return value. And for setters, there is no
return value at all.
This is becoming a very serious problem in my application. Architecturally,
it seems wrong for all of this error reporting complexity to be repeated
over and over in each accessor, but I don't see another approach. Cocoa
exceptions don't appear to be possible because they are not supported in a
uniform way by clients (e.g. Cocoa scripting does not handle them).
How do others deal with this issue?
Cheers
-Mark
------------------------------------------------------------------------
Mark Alldritt Late Night Software Ltd.
Phone: 250-380-1725 Script Debugger 3.0 - AppleScript IDE
WEB: http://www.latenightsw.com/ FaceSpan 4.2 - AppleScript RAD
Affrus 1.0 - Perl Debugging
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden