(self,
orig, # type: pycbc_result
return_exceptions, # type: bool
obs_handler=None # type: Optional[ObservableRequestHandler]
)
| 861 | |
| 862 | class MultiCounterResult: |
| 863 | def __init__(self, |
| 864 | orig, # type: pycbc_result |
| 865 | return_exceptions, # type: bool |
| 866 | obs_handler=None # type: Optional[ObservableRequestHandler] |
| 867 | ): |
| 868 | |
| 869 | self._orig = orig |
| 870 | self._all_ok = self._orig.raw_result.pop('all_okay', False) |
| 871 | self._results = {} |
| 872 | for k, v in self._orig.raw_result.items(): |
| 873 | # pycbc_result and pycbc_exception have a core_span member |
| 874 | if obs_handler and hasattr(v, 'core_span'): |
| 875 | obs_handler.process_core_span(v.core_span) |
| 876 | if isinstance(v, (CouchbaseException, PycbcCoreException)): |
| 877 | if isinstance(v, PycbcCoreException): |
| 878 | exc = ErrorMapper.build_exception(v) |
| 879 | else: |
| 880 | exc = v |
| 881 | if obs_handler: |
| 882 | obs_handler.process_multi_sub_op(v, exc_val=exc) |
| 883 | if not return_exceptions: |
| 884 | raise exc |
| 885 | else: |
| 886 | self._results[k] = exc |
| 887 | else: |
| 888 | if obs_handler: |
| 889 | obs_handler.process_multi_sub_op(v) |
| 890 | self._results[k] = CounterResult(v) |
| 891 | |
| 892 | @property |
| 893 | def all_ok(self) -> bool: |
nothing calls this directly
no test coverage detected