In the rest service, if the service side generates exception information, whether it is a business exception or a system exception, if the exception is thrown directly in the client browser, it is not possible to get the details of the exception, only get a statecode Internal Server error error, as follows:
http/1.1 Internal Server errorcontentContent-type:text/xml; charset=utf-8server:microsoft-httpapi/2.013 :£ º GMT<error><message>an Error has occurred.</message ></Error>
If you need to get detailed exception information on the server side of the client, you need to define the exception information as follows:
var New Httpresponsemessage (httpstatuscode.forbidden) { new stringcontent ("notallowed To delete this resource"), "Forbidden"}; Throw New Httpresponseexception (RESP);
Throwing httpresponseexception can be captured and processed in the client (browser, debugging tools such as Fiddler), as follows:
http/1.1403 forbiddencontentContent-type:text/plain; charset=utf-8server:microsoft-httpapi/2.013 :+: This resource
Exception Handling in REST services