On Wednesday, Nov 13, 2002, at 10:57 US/Pacific, Alexander Sherwood
wrote:
> When using CFTHROW with Web Services, is there a way to trim down the
> error
> message returned?
>
> When called as a component, the cfcatch.detail and cfcatch.message are
> fine, but when called as a web service, they are loaded with AXIS fault
> codes, etc.
>
> How has anyone else handled this?
Ugly, isn't it? My team decided to not throw exceptions out of the Web
Service and instead return a struct with the first element indicating
success / failure and the second element being either the result (for
success) or the CF exception details (for failure). That means that all
our Web Service methods look like:
<cffunction name="foo" ...>
...args...
<cfset returnValue = structNew()/>
<cfset returnValue.success = true/>
<cftry>
...
do a bunch of stuff
...
<cfset returnValue.result = whatever/>
<cfcatch type="any">
<cfset returnValue.success = false/>
<cfset returnValue.result = structNew()/>
<cfset returnValue.result.message = cfcatch.message/>
<!--- etc --->
</cfcatch>
</cftry>
<cfreturn returnValue/>
</cffunction>
Sean A Corfield -- Director, Architecture
Web Technology Group -- Macromedia, Inc.
tel: (415) 252-2287 -- cell: (415) 717-8473
aim: seancorfield -- http://www.macromedia.com
An Architect's View -- http://www.corfield.org/blog/
Introducing Macromedia Contribute. Web publishing for everyone.
Learn more at http://www.macromedia.com/contribute
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm