mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-01 10:38:10 +00:00
Infrastructure for reporting configuration errors via exceptions
Once the actual config-parsing code start raising these exceptions instead of directly calling sys.exit(), the user experience would deteriorate due to raw exception traces. There's little value in the trace itself, so just wrap the whole config loading with pretty error formatting. We still do not point to a specific place where that error is defined (such as a line/column in a given JSON file) because that information is already lost by the time we perform these checks. Also, these checks are largely open-coded ad-hoc stuff. Some required items are not covered, raising KeyError instead. We should get a formal schema for these...
This commit is contained in:
13
gnpy/core/exceptions.py
Normal file
13
gnpy/core/exceptions.py
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
gnpy.core.exceptions
|
||||
====================
|
||||
|
||||
Exceptions thrown by other gnpy modules
|
||||
'''
|
||||
|
||||
|
||||
class ConfigurationError(Exception):
|
||||
'''User-provided configuration contains an error'''
|
||||
Reference in New Issue
Block a user