Skip to content

Commit

Permalink
chg: Add logging on invalid capture settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Jul 22, 2024
1 parent e821e0b commit 19ef6d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions website/web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

logging.config.dictConfig(get_config('logging'))

logger = logging.getLogger(__name__)

app: Flask = Flask(__name__)

app.wsgi_app = ReverseProxied(app.wsgi_app) # type: ignore[method-assign]
Expand All @@ -40,8 +42,10 @@
def handle_pydandic_validation_exception(error: CaptureSettingsError) -> tuple[dict[str, Any], int]:
'''Return the validation error message and 400 status code'''
if error.pydantic_validation_errors:
logger.warning(f'Unable to validate capture settings: {error.pydantic_validation_errors}')
return {'message': 'Unable to validate capture settings.',
'details': error.pydantic_validation_errors.errors()}, 400
logger.warning(f'Unable to validate capture settings: {error}')
return {'message': str(error)}, 400


Expand Down

0 comments on commit 19ef6d1

Please sign in to comment.