Better error handling in User API