this is (sort of) related to a previous thread (Method Question (was
RE: [CFCDev] OO Security?)
http://www.mail-archive.com/[email protected]/msg08384.html

during a method's running it may (deliberatly) fail in multiple
places. These are mostly foreign-key-constraint-type breaking of
business rules (ie in code but not necessarily set in the db).

a case in point is a delete entity method that has about 3 areas that
it could fail on. The trouble I'm having is sending context-specific
messages back to the user.

preaviously we've been returning "false" if an insert/update/delete
failed but now the UI needs to knowwhy so it can reset and allow the
user to have another go.

some ideas being kicked around:
1) changing the return type from BOOLEAN to STRUCT and returning
result.bOK = false
result.msg = "unique ID already exists"
 - or - 
2) keep the BOOLEAN (false) value but throw an error to a specific
error object. Break encapsulation by sending the context error message
to the error object to then dump in REQUEST scope. If the UI gets back
FALSE then it checks REQUEST scope for the error and works out what it
needs to do with it (eg: display message + repopulate the form)

I don't like either idea. the BOOLEAN was working just fine but it
just isn't specific enough for different messages to be sent back to
the UI.

any thoughts?

thanx
barry.b


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]


Reply via email to