I have a web service written in C #. When errors occur on the server, I would like to inform the user of the client side. This works great by throwing exception servers, which are then sent to my client side error handler.
However, I would like, when I have selected the exception, to set a property that describes how seriously I think the error is at the moment. Thus, I can decide the client side how to display the error:
WebService.Method(some_value, handle_response, handle_error);
function handle_response (response) {
}
function handle_error (error) {
if(error.level === 'Critical') {
} else if(error.level === 'Warning') {
} else
...
}
}
My solution so far has been to create a custom exception that inherits from System.Exception. My web service is returning with a formatted result JSON.
My problem is how to pass my property to client side JSON response?