[Matahari] [PATCH 2/2] Better error handling in check_authorization