group exceptions to 2 types: failure and error

This commit is contained in:
httprunner
2018-07-25 10:40:20 +08:00
parent 505f4d5dbc
commit e6a834c6c6
12 changed files with 60 additions and 54 deletions

View File

@@ -111,7 +111,7 @@ class ResponseObject(object):
top_query_content = top_query_content.__dict__
else:
top_query_content = json.loads(top_query_content)
except json.decoder.JSONDecodeError:
except exception.JSONDecodeError:
err_msg = u"Failed to extract data with delimiter!\n"
err_msg += u"response content: {}\n".format(self.content)
err_msg += u"regex: {}\n".format(field)
@@ -145,8 +145,8 @@ class ResponseObject(object):
msg += "\t=> {}".format(value)
logger.log_debug(msg)
# TODO: unify ParseResponseError type
except (exception.ParseResponseError, TypeError):
# TODO: unify ParseResponseFailure type
except (exception.ParseResponseFailure, TypeError):
logger.log_error("failed to extract field: {}".format(field))
raise