Why is nesting or piggybacking errors within errors bad in general?
Posted
by
dietbuddha
on Programmers
See other posts from Programmers
or by dietbuddha
Published on 2012-10-01T19:08:22Z
Indexed on
2012/10/01
21:50 UTC
Read the original article
Hit count: 286
Why is nesting or piggybacking errors within errors bad in general?
To me it seems bad intuitively, but I'm suspicious in that I cannot adequately articulate why it is bad. This may be because it is not in general bad and that it is only bad in specific instances. Why is it detrimental to design error/exception handling in such a way.
The specific instance is that of a REST service. There is a desire by some to use http errors (specifically the 500 response) as a way to indicate any problem with specific instances of a resource. An example of an instance resource in this case would be:
http://server/ticket/80 # instance http://server/ticket # not an instance
So this is the behavior that is being proposed.
- If
ticket 80
does not exist return a http response code of500
. Within the body of the error return the "real" error as an additional error code and description. - If the
ticket
resource doesn't exist return a response code of 404.
© Programmers or respective owner