So the base class, RequestException here is looking for all the things added by the exception handling middleware on the server. You will need to change the server-side exception to derive from PulpException and then change the decorator to raise the exception instead using the RESTController.unauthorized method.