|
From: Peter De B. (JIRA) <no...@sp...> - 2008-02-01 10:11:44
|
[ http://jira.springframework.org/browse/RCP-534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_31526 ]
Peter De Bruycker commented on RCP-534:
---------------------------------------
suppose you provide integration with another system. The communication with this system returns errorcodes if something goes wrong. You can create an exception for each possible error code you can get back, or you can create one exception that takes the errorcode.
The exception handling stuff can then fetch the error message like this:
1. errorcode
2. some.package.OtherSystemCommunicationException
3. ...
This means you can provide error messages for the codes you know, and fall back to the default behaviour, when there's an error code you didn't expect.
<code>
public class OtherSystemCommunicationException extends RuntimeException implements ErrorCoded {
private String errorCode;
public SomeBusinessException(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorCode() {
return errorCode;
}
}
</code>
This is something I could have used several years ago, when integrating with the customs application ;-)
> Make Exception handling aware of "ErrorCoded" exceptions
> --------------------------------------------------------
>
> Key: RCP-534
> URL: http://jira.springframework.org/browse/RCP-534
> Project: Spring Framework Rich Client Project
> Issue Type: Improvement
> Components: Application Framework
> Reporter: Peter De Bruycker
> Attachments: RCP-534.patch
>
>
> As suggested in the forum: http://forum.springframework.org/showthread.php?t=49277
> If an exception implements ErrorCoded, the error code should be to fetch the message to display.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springframework.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|