views:

98

answers:

2

We are designing set of web services which will return XML string in response. These are RESTFul services so I will have to send exception inside element. I am planing to design set of Error code which can help me determine where level occured just by looking at the code.

For Example

1000 - Application Level
2000 - DB level
3000 - Network level

so if I have error message then I can know right away that this was an application level error and it came from 1st business module.

I am not very experience in this so I would love to here your thoughts and criticism.

Thanks

+1  A: 

RESTful implies that you will leverage the underlying protocol, in this case HTTP. HTTP already has a pre-defined list of status codes. I would leverage that structure, and add ancillary information as required.

Please do not return "200" on an error :-)

Yann Ramin
yes but I can not use those error codes for business logic level error right ? ...HTML error codes will be useful when there is connectivity error or bad request error. Am I missing something ? Can you may be give an example ?
Ved
A: 

I am going with simple xml error code return type.

So in my code if there is an error , return xml will be

error description

Ved