Hello,
Let's say the grid makes a GET to api/tickets/2/lines to get the lines for ticket # 2, and the Web API controller cannot find that ticket. It creates an HttpResponseMessage like this:
The raw HTTP response is:
In the grid's dataSource, I have defined an error event handler:
The handler gets called, but e.errors is undefined. Looking at e, there I cannot find the error message, "Ticket not found: 2" anywhere.
How can I get to my message?
Also, do you have a recommended approach for handling and displaying errors during grid operations (I was planning to use Toastr or similar to display the friendly message, in addition to obviously log details server-side).
Thanks,
Lars
Let's say the grid makes a GET to api/tickets/2/lines to get the lines for ticket # 2, and the Web API controller cannot find that ticket. It creates an HttpResponseMessage like this:
return Request.CreateErrorResponse(HttpStatusCode.NotFound, "Ticket not found: " + ticketId);The raw HTTP response is:
HTTP/1.1 404 Not FoundCache-Control: no-cachePragma: no-cacheContent-Type: application/json; charset=utf-8Expires: -1Server: Microsoft-IIS/8.0X-AspNet-Version: 4.0.30319X-SourceFiles: =?UTF-8?B?QzpcRG90TmV0XFdlYlBvc1xXZWJQb3NcYXBpXHRpY2tldHNcMlxsaW5lcw==?=X-Powered-By: ASP.NETDate: Mon, 08 Sep 2014 00:25:57 GMTContent-Length: 60{"message":"Ticket not found: 2"}In the grid's dataSource, I have defined an error event handler:
error: function(e) { if (e.errors) { alert(e.errors); this.cancelChanges(); }},How can I get to my message?
Also, do you have a recommended approach for handling and displaying errors during grid operations (I was planning to use Toastr or similar to display the friendly message, in addition to obviously log details server-side).
Thanks,
Lars