I can't really say that building a robust UI is my cup of tea but sometimes every developer has to write even a very simple UI for its application. In the recent years JSON has become de facto standard in the way data are being passed between backend services and the UI layer and while the whole process is pretty simple, exceptions handling or put it in a different way their communicating to the UI could be done in two different ways
1. Using existing HTML headers and passing some comments in the page body
2. Using existing HTML headers + using JSON string to communicate what went wrong.