diff --git a/mindinsight/datavisual/common/exceptions.py b/mindinsight/datavisual/common/exceptions.py index d99f1fdf9201ba4c79bcb8c4fd1fb68ac2bb9e28..05fdcd624577776e3e4f262bf6657fe72e34e588 100644 --- a/mindinsight/datavisual/common/exceptions.py +++ b/mindinsight/datavisual/common/exceptions.py @@ -83,10 +83,10 @@ class NodeNotInGraphError(MindInsightException): http_code=400) -class MaxCountExceededException(MindInsightException): +class MaxCountExceededError(MindInsightException): """Count is out of limit.""" def __init__(self): error_msg = "Count is out of limit." - super(MaxCountExceededException, self).__init__(DataVisualErrors.NODE_NOT_IN_GRAPH_ERROR, - error_msg, - http_code=400) + super(MaxCountExceededError, self).__init__(DataVisualErrors.MAX_COUNT_EXCEEDED_ERROR, + error_msg, + http_code=400) diff --git a/mindinsight/datavisual/data_transform/summary_watcher.py b/mindinsight/datavisual/data_transform/summary_watcher.py index 7d6d59ffe4c695ff58179395f93304240d36d4e7..e9680c6ba7dcd68eb628f77be43a816927b08bf8 100644 --- a/mindinsight/datavisual/data_transform/summary_watcher.py +++ b/mindinsight/datavisual/data_transform/summary_watcher.py @@ -22,7 +22,7 @@ from pathlib import Path from mindinsight.datavisual.common.log import logger from mindinsight.datavisual.common.validation import Validation from mindinsight.datavisual.utils.tools import Counter -from mindinsight.utils.exceptions import ParamValueError +from mindinsight.datavisual.common.exceptions import MaxCountExceededError from mindinsight.utils.exceptions import FileSystemPermissionError @@ -87,7 +87,7 @@ class SummaryWatcher: break try: counter.add() - except ParamValueError: + except MaxCountExceededError: logger.info('Stop further scanning due to overall is False and ' 'number of scanned files exceeds upper limit.') break @@ -132,7 +132,7 @@ class SummaryWatcher: break try: counter.add() - except ParamValueError: + except MaxCountExceededError: logger.info('Stop further scanning due to overall is False and ' 'number of scanned files exceeds upper limit.') break diff --git a/mindinsight/datavisual/utils/tools.py b/mindinsight/datavisual/utils/tools.py index 833334107afc3e1f491ab23aff73aaade197b5b9..1b4322d102fa3ceb4074e67eebe0a2d3c4be8489 100644 --- a/mindinsight/datavisual/utils/tools.py +++ b/mindinsight/datavisual/utils/tools.py @@ -20,7 +20,7 @@ import os from numbers import Number from urllib.parse import unquote -from mindinsight.datavisual.common.exceptions import MaxCountExceededException +from mindinsight.datavisual.common.exceptions import MaxCountExceededError from mindinsight.utils import exceptions _IMG_EXT_TO_MIMETYPE = { @@ -165,5 +165,5 @@ class Counter: def add(self, value=1): """Add value.""" if self._max_count is not None and self._count + value > self._max_count: - raise MaxCountExceededException() + raise MaxCountExceededError() self._count += value diff --git a/mindinsight/utils/constant.py b/mindinsight/utils/constant.py index b9eaca99e6d94c0f9bc85129fbf8fd42bd2309b8..67a2cbc65d7e0670e730530f8b5c2a98cc203e31 100644 --- a/mindinsight/utils/constant.py +++ b/mindinsight/utils/constant.py @@ -50,7 +50,7 @@ class DataVisualErrors(Enum): """Enum definition for datavisual errors.""" RESTFUL_API_NOT_EXIST = 1 REQUEST_METHOD_NOT_ALLOWED = 2 - SUMMARY_LOG_CONTENT_INVALID = 3 + MAX_COUNT_EXCEEDED_ERROR = 3 CRC_FAILED = 4 TRAIN_JOB_NOT_EXIST = 5 SUMMARY_LOG_PATH_INVALID = 6