Mercurial > repos > dcouvin > resfinder4
comparison resfinder/cge/out/exceptions.py @ 0:55051a9bc58d draft default tip
Uploaded
| author | dcouvin |
|---|---|
| date | Mon, 10 Jan 2022 20:06:07 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:55051a9bc58d |
|---|---|
| 1 #!/usr/bin/env python3 | |
| 2 | |
| 3 | |
| 4 class CGECoreOut(Exception): | |
| 5 """ Root for all submodule out exceptions in the cgecore module. | |
| 6 Only used to enable "except" of all exceptions from submodule. | |
| 7 Never raised. | |
| 8 """ | |
| 9 pass | |
| 10 | |
| 11 | |
| 12 class CGECoreOutTypeError(CGECoreOut): | |
| 13 """ Raised when the 'type' specified is not defined in the json | |
| 14 definition, if it is missing. | |
| 15 """ | |
| 16 def __init__(self, message, *args): | |
| 17 self.message = message | |
| 18 # allow users initialize misc. arguments as any other builtin Error | |
| 19 super(CGECoreOutTypeError, self).__init__(message, *args) | |
| 20 | |
| 21 | |
| 22 class CGECoreOutInputError(CGECoreOut): | |
| 23 """ Raised when some of the data stored in a Result object did not pass | |
| 24 validation based on the JSON definition. | |
| 25 """ | |
| 26 def __init__(self, message, errors, *args): | |
| 27 self.message = message | |
| 28 self.errors = errors | |
| 29 # allow users initialize misc. arguments as any other builtin Error | |
| 30 super(CGECoreOutInputError, self).__init__(message, errors, *args) | |
| 31 | |
| 32 | |
| 33 class CGECoreOutTranslateError(CGECoreOut): | |
| 34 """ Raised when keys for the given type of Translate object does not match" | |
| 35 a key in the JSON definition | |
| 36 """ | |
| 37 def __init__(self, message, *args): | |
| 38 self.message = message | |
| 39 # allow users initialize misc. arguments as any other builtin Error | |
| 40 super(CGECoreOutTranslateError, self).__init__(message, *args) |
