Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else:
self.meta.update(response_obj.meta)
message = JsonApiMessage(data=data,included=included,meta=self.meta,do_nesting=self.nest_in_responses).to_json() #render json response
#caching
if self.cached_set_hook != None and loaded_from_cache == False:
janus_logger.debug("Caching message")
self.cached_set_hook(response_obj,message)
if self.before_send_hook != None: #fire before send hook
self.before_send_hook(self.success_status,message,response_obj)
return message
except Exception as e:
err_msg = ErrorMessage.from_exception(e)
tb = traceback.format_exc()
if self.include_traceback_in_errors:
if err_msg.meta == None: err_msg.meta = {}
err_msg.traceback = tb
if self.error_hook != None:
self.error_hook(int(err_msg.status),err_msg,tb)
message = JsonApiMessage(errors=err_msg,meta=self.meta).to_json()
janus_logger.error("Traceback: " + tb)
return message