Looking at: https://github.com/ServiceStack/ServiceStack/wiki/Error-Handling#webserviceexception
It appears that this documentation might be out of date with what we are seeing in v.56.
Calling a service with JsonServiceClient, and we implement the service like this to throw an InvalidOperationException:
public class GetThrowerDto : IReturn<GetThrowerDtoResponse>
{
public string ExceptionType { get; set; }
}
public class GetThrowerDtoResponse
{
public ResponseStatus ResponseStatus { get; set; }
}
...
[Route("/testing/thrower", "GET")]
public object Get(GetThrowerDto request)
{
throw new InvalidOperationException("amessage");
}
inspecting the WebServiceException
created by a JsonServiceClient
If we then throw InvalidOperationException
, it looks like this:
StatusCode: 500
ErrorCode: "InvalidOperationException"
Message: "InvalidOperationException"
ErrorMessage: "amessage"
StatusDescription: "InvalidOperationException"
If we then throw ArgumentOutOfRangeException
, it looks like this:
StatusCode: 400
ErrorCode: "ArgumentOutOfRangeException"
Message: "ArgumentOutOfRangeException"
ErrorMessage: "Specified argument was out of the range of valid values.\r\nParameter name: amessage"
StatusDescription: "ArgumentOutOfRangeException"