lai
1
I’m trying to display error messages from a SS service.
I’m throwing the following
throw new ArgumentException("Somthing not right here!!!!");
And in my vue component the calling code is the following
try {
let request = new CreateUserVehicle();
var response = await createUserVehicle(request);
this.userVehicle = response.userVehicle;
} catch (error) {
console.log(error.responseStatus);
this.responseStatus = error.responseStatus || error;
}
the console log is only showing
ResponseStatus {errorCode: "400", message: "ArgumentException"}
How do I show the message that I am throwing in the service? I’ve tried looking at the techstacks project but can’t figure out how it is done.
mythz
2
Does the raw HTTP Response Headers contain the structured Error Response?
lai
3
No it doesn’t appear so,
HTTP/1.1 400 ArgumentException
content-type: application/json; charset=utf-8
vary: Accept
server: Kestrel
access-control-allow-credentials: true
access-control-allow-headers: Content-Type, Allow, Authorization
access-control-allow-methods: GET, POST, PUT, DELETE, PATCH, OPTIONS
access-control-allow-origin: *
x-powered-by: ServiceStack/5.11 NETStandard/.NET, ASP.NET
x-sourcefiles: =?UTF-8?B?QzpcRGV2XEFzcFN1cHBvcnRcQXNwU3VwcG9ydFxBc3BTdXBwb3J0XGpzb25ccmVwbHlcVXBkYXRlVXNlclZlaGljbGU=?=
date: Wed, 18 Jul 2018 19:19:39 GMT
connection: close
Content-Length: 20
{"userVehicle":null}
mythz
4
If you’re using a {Request}Response
convention for your Response DTO it needs a ResponseStatus
property, see docs for more info:
http://docs.servicestack.net/error-handling#error-response-types
1 Like