diff options
| author | morefigs <morefigs@gmail.com> | 2019-02-09 11:16:32 +1100 |
|---|---|---|
| committer | morefigs <morefigs@gmail.com> | 2019-02-09 11:16:32 +1100 |
| commit | 69f6c5d90b436f48bf078e39390aef59c43f67c8 (patch) | |
| tree | 9ebe43f47ee7156b5385d3ec79ffb16c2c7b3858 | |
| parent | 0f796a27f515061263606f29e44cd67402bacf09 (diff) | |
| download | pymba-69f6c5d90b436f48bf078e39390aef59c43f67c8.tar.gz pymba-69f6c5d90b436f48bf078e39390aef59c43f67c8.zip | |
added a new error type to deal with attempting to get / set a command feature data type
| -rw-r--r-- | pymba/feature.py | 5 | ||||
| -rw-r--r-- | pymba/vimba_exception.py | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/pymba/feature.py b/pymba/feature.py index 7ac403d..9156bad 100644 --- a/pymba/feature.py +++ b/pymba/feature.py @@ -80,6 +80,11 @@ class Feature: 'range': 2, } + # doesn't make sense to get / set a command data type + if data_type == _FEATURE_DATA_COMMAND: + raise VimbaException(VimbaException.ERR_COMMAND_MUST_BE_CALLED) + + # some data types aren't implemented try: return access_funcs[data_type][access_indices[func_type]] except IndexError: diff --git a/pymba/vimba_exception.py b/pymba/vimba_exception.py index 22f03c2..992e299 100644 --- a/pymba/vimba_exception.py +++ b/pymba/vimba_exception.py @@ -24,11 +24,13 @@ class VimbaException(Exception): ERR_FEATURE_NOT_SUPPORTED, ERR_PARTIAL_REGISTER_ACCESS, - # -50 to -56 + # -50 to -53 + ERR_UNDEFINED_ERROR_CODE, ERR_FRAME_BUFFER_MEMORY, ERR_NOT_IMPLEMENTED_IN_PYMBA, - ERR_UNDEFINED_ERROR_CODE, - ) = tuple(range(0, -20, -1)) + tuple(range(-50, -53, -1)) + ERR_COMMAND_MUST_BE_CALLED, + ) = tuple(range(0, -20, -1)) + \ + tuple(range(-50, -54, -1)) ERRORS = { # Vimba C API specific errors @@ -54,9 +56,10 @@ class VimbaException(Exception): ERR_PARTIAL_REGISTER_ACCESS: 'A multiple registers read or write was partially completed.', # Custom errors + ERR_UNDEFINED_ERROR_CODE: 'Undefined error code', ERR_FRAME_BUFFER_MEMORY: 'Not enough memory to assign frame buffer.', ERR_NOT_IMPLEMENTED_IN_PYMBA: 'This function is not yet implemented in Pymba', - ERR_UNDEFINED_ERROR_CODE: 'Undefined error code', + ERR_COMMAND_MUST_BE_CALLED: 'Cannot get or set the value of a command feature type, call the command instead.' } @property |
