@@ -47,25 +47,30 @@ def map_to_scicrunch_error(rrid: str, error_code: int, message: str) -> Scicrunc
4747 <= status .HTTP_511_NETWORK_AUTHENTICATION_REQUIRED
4848 ), error_code # nosec
4949
50- custom_error = ScicrunchError (reason = "Unexpected error in scicrunch.org" )
50+ custom_error = ScicrunchError (
51+ reason = "Unexpected error in scicrunch.org" , original_message = message
52+ )
5153
5254 if error_code == web_exceptions .HTTPBadRequest .status_code :
53- custom_error = InvalidRRIDError (rrid = rrid )
55+ custom_error = InvalidRRIDError (rrid = rrid , original_message = message )
5456
5557 elif error_code == web_exceptions .HTTPNotFound .status_code :
56- custom_error = InvalidRRIDError (msg_template = f"Did not find any '{ rrid } '" )
58+ custom_error = InvalidRRIDError (
59+ msg_template = f"Did not find any '{ rrid } '" , original_message = message
60+ )
5761
5862 elif error_code == web_exceptions .HTTPUnauthorized .status_code :
5963 custom_error = ScicrunchConfigError (
6064 reason = "osparc was not authorized to access scicrunch.org."
61- "Please check API access tokens."
65+ "Please check API access tokens." ,
66+ original_message = message ,
6267 )
6368
6469 elif (
6570 error_code >= status .HTTP_500_INTERNAL_SERVER_ERROR
6671 ): # scicrunch.org server error
6772 custom_error = ScicrunchServiceError (
68- reason = "scicrunch.org cannot perform our requests"
73+ reason = "scicrunch.org cannot perform our requests" , original_message = message
6974 )
7075
7176 return custom_error
0 commit comments