rest app error handling