Update python2 to python3
[vfc/nfvo/lcm.git] / lcm / ns / views / sol / common.py
index 2d9c717..dd5eb64 100644 (file)
@@ -20,6 +20,7 @@ from rest_framework.response import Response
 
 from lcm.pub.exceptions import BadRequestException
 from lcm.pub.exceptions import NSLCMException
+from lcm.pub.exceptions import SeeOtherException
 
 logger = logging.getLogger(__name__)
 
@@ -39,20 +40,26 @@ def view_safe_call_with_log(logger):
         def wrapper(*args, **kwargs):
             try:
                 return func(*args, **kwargs)
+            except SeeOtherException as e:
+                logger.error(e.args[0])
+                return make_error_resp(
+                    detail=e.args[0],
+                    status=status.HTTP_303_SEE_OTHER
+                )
             except BadRequestException as e:
-                logger.error(e.message)
+                logger.error(e.args[0])
                 return make_error_resp(
-                    detail=e.message,
+                    detail=e.args[0],
                     status=status.HTTP_400_BAD_REQUEST
                 )
             except NSLCMException as e:
-                logger.error(e.message)
+                logger.error(e.args[0])
                 return make_error_resp(
-                    detail=e.message,
+                    detail=e.args[0],
                     status=status.HTTP_500_INTERNAL_SERVER_ERROR
                 )
             except Exception as e:
-                logger.error(e.message)
+                logger.error(e.args[0])
                 logger.error(traceback.format_exc())
                 return make_error_resp(
                     detail='Unexpected exception',