Merge "Allow specify log level for Error exception"

This commit is contained in:
Jenkins 2016-03-10 12:05:37 +00:00 committed by Gerrit Code Review
commit aea60cdc4a
2 changed files with 9 additions and 3 deletions

View File

@ -103,9 +103,9 @@ LOG = getProcessingLogger(__name__)
class Error(Exception):
"""Inspector exception."""
def __init__(self, msg, code=400, **kwargs):
def __init__(self, msg, code=400, log_level='error', **kwargs):
super(Error, self).__init__(msg)
LOG.error(msg, **kwargs)
getattr(LOG, log_level)(msg, **kwargs)
self.http_code = code
@ -113,7 +113,8 @@ class NotFoundInCacheError(Error):
"""Exception when node was not found in cache during processing."""
def __init__(self, msg, code=404):
super(NotFoundInCacheError, self).__init__(msg, code)
super(NotFoundInCacheError, self).__init__(msg, code,
log_level='info')
def executor():

View File

@ -0,0 +1,5 @@
---
other:
- Log level for error when node was not found in Inspector cache was
changed from error to info level. It was done because not_found_hook
may handle this case, so this wouldn't be error anymore.