rest error handling