forked from xybu/onedrived-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Xiangyu Bu <[email protected]>
- Loading branch information
Showing
8 changed files
with
327 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 12 additions & 12 deletions
24
...ived/od_models/configurator/exceptions.py → onedrived/od_models/dict_guard/exceptions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,63 @@ | ||
class ConfiguratorError(Exception): | ||
class DictGuardError(Exception): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(args, kwargs) | ||
|
||
|
||
class ConfiguratorSchemaError(ConfiguratorError): | ||
class DictGuardSchemaError(DictGuardError): | ||
def __init__(self, schema): | ||
super().__init__() | ||
self.bad_schema = schema | ||
|
||
|
||
class UnsupportedSchemaType(ConfiguratorSchemaError): | ||
class UnsupportedSchemaType(DictGuardSchemaError): | ||
def __init__(self, schema_type, schema): | ||
super().__init__(schema) | ||
self.bad_schema_type = schema_type | ||
|
||
|
||
class ConfiguratorKeyError(ConfiguratorError): | ||
class DictGuardKeyError(DictGuardError): | ||
def __init__(self, key): | ||
self.key = key | ||
|
||
|
||
class ConfiguratorValueError(ConfiguratorError): | ||
class DictGuardValueError(DictGuardError): | ||
def __init__(self, key, value): | ||
super().__init__() | ||
self.key = key | ||
self.value = value | ||
|
||
|
||
class IntValueRequired(ConfiguratorValueError): | ||
class IntValueRequired(DictGuardValueError): | ||
pass | ||
|
||
|
||
class IntValueBelowMinimum(ConfiguratorValueError): | ||
class IntValueBelowMinimum(DictGuardValueError): | ||
def __init__(self, key, value, minimum): | ||
super().__init__(key, value) | ||
self.minimum = minimum | ||
|
||
|
||
class IntValueAboveMaximum(ConfiguratorValueError): | ||
class IntValueAboveMaximum(DictGuardValueError): | ||
def __init__(self, key, value, maximum): | ||
super().__init__(key, value) | ||
self.maximum = maximum | ||
|
||
|
||
class StringNotStartsWith(ConfiguratorValueError): | ||
class StringNotStartsWith(DictGuardValueError): | ||
def __init__(self, key, value, expected_starts_with): | ||
super().__init__(key, value) | ||
self.expected_starts_with = expected_starts_with | ||
|
||
|
||
class StringInvalidChoice(ConfiguratorValueError): | ||
class StringInvalidChoice(DictGuardValueError): | ||
def __init__(self, key, value, choices_allowed): | ||
super().__init__(key, value) | ||
self.choices_allowed = choices_allowed | ||
|
||
|
||
class PathDoesNotExist(ConfiguratorValueError): | ||
class PathDoesNotExist(DictGuardValueError): | ||
pass | ||
|
||
|
||
class PathIsNotFile(ConfiguratorValueError): | ||
class PathIsNotFile(DictGuardValueError): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"webhook_port": { | ||
"type": "integer", | ||
"minimum": 1, | ||
"maximum": 65536, | ||
"@default_value": 8080, | ||
"description": "@lang['config.webhook_port.desc']" | ||
}, | ||
"logfile_path": { | ||
"type": "string", | ||
"subtype": "file", | ||
"to_abspath": true, | ||
"create_if_missing": true, | ||
"allow_empty": true, | ||
"permissions": "w", | ||
"@default_value": "/var/log/onedrived.log", | ||
"description": "@lang['config.logfile_path.desc']" | ||
}, | ||
"webhook_type": { | ||
"type": "string", | ||
"choices": ["direct", "ngrok"], | ||
"@default_value": "direct", | ||
"description": "@lang['config.webhook_type.desc']" | ||
}, | ||
"webhook_host": { | ||
"type": "string", | ||
"@default_value": "haha", | ||
"description": "@lang['config.webhook_host.desc']" | ||
}, | ||
"https_url": { | ||
"type": "string", | ||
"allow_empty": true, | ||
"@default_value": "https://foo/bar", | ||
"starts_with": "https://" | ||
} | ||
} |
Oops, something went wrong.