From: fujinhua Date: Sat, 20 Apr 2019 08:03:02 +0000 (+0800) Subject: Add see other error for catalog X-Git-Tag: 1.3.0~19 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=2b1e95ce4ccae4889effa60b079495e8a18476d5;p=vfc%2Fnfvo%2Fcatalog.git Add see other error for catalog Change-Id: I0dea9bc4d591c196bad2358b5b200b6e59ffbe9d Issue-ID: VFC-1307 Signed-off-by: fujinhua --- diff --git a/catalog/packages/views/common.py b/catalog/packages/views/common.py index e902f578..73f82c47 100644 --- a/catalog/packages/views/common.py +++ b/catalog/packages/views/common.py @@ -23,6 +23,7 @@ from catalog.pub.exceptions import NsdmBadRequestException from catalog.pub.exceptions import PackageNotFoundException from catalog.pub.exceptions import ResourceNotFoundException from catalog.pub.exceptions import ArtifactNotFoundException +from catalog.pub.exceptions import NsdmDuplicateSubscriptionException logger = logging.getLogger(__name__) @@ -54,6 +55,12 @@ def view_safe_call_with_log(logger): def wrapper(*args, **kwargs): try: return func(*args, **kwargs) + except NsdmDuplicateSubscriptionException as e: + logger.error(e.message) + return make_error_resp( + detail=e.message, + status=status.HTTP_303_SEE_OTHER + ) except PackageNotFoundException as e: logger.error(e.message) return make_error_resp(