Before calling the render callbacks you registered, Laravel calls its internal ->prepareException(...) method:
And this method converts the AuthorizationException to a AccessDeniedHttpException:
So your render callbacks for a AuthorizationException will never get called.
On the bright side you can get the previous exception from that one, check if it is an AuthorizationException and check the code for it:
$this->renderable(function (AccessDeniedHttpException $e, $request) {
$previous = $e->getPrevious();
if ($previous instanceof AuthorizationException) {
// assuming ->respondWithError(...) is a private method
// on your handler
return $this->respondWithError($e->getCode() ?: 1010);
}
// let handler follow its course, AccessDeniedHttpException
// is thrown from other places in the framework
// unrelated to the Policies flow
return null;
});