Catch exception thrown by the backend and give error message in the UI