(self,
orig, # type: pycbc_result
return_exceptions, # type: bool
obs_handler=None # type: Optional[ObservableRequestHandler]
)
| 527 | |
| 528 | class MultiExistsResult: |
| 529 | def __init__(self, |
| 530 | orig, # type: pycbc_result |
| 531 | return_exceptions, # type: bool |
| 532 | obs_handler=None # type: Optional[ObservableRequestHandler] |
| 533 | ) -> None: |
| 534 | |
| 535 | self._orig = orig |
| 536 | self._all_ok = self._orig.raw_result.pop('all_okay', False) |
| 537 | self._results = {} |
| 538 | for k, v in self._orig.raw_result.items(): |
| 539 | # pycbc_result and pycbc_exception have a core_span member |
| 540 | if obs_handler and hasattr(v, 'core_span'): |
| 541 | obs_handler.process_core_span(v.core_span) |
| 542 | if isinstance(v, (CouchbaseException, PycbcCoreException)): |
| 543 | if isinstance(v, PycbcCoreException): |
| 544 | exc = ErrorMapper.build_exception(v) |
| 545 | else: |
| 546 | exc = v |
| 547 | if obs_handler: |
| 548 | obs_handler.process_multi_sub_op(v, exc_val=exc) |
| 549 | if not return_exceptions: |
| 550 | raise exc |
| 551 | else: |
| 552 | self._results[k] = exc |
| 553 | else: |
| 554 | if obs_handler: |
| 555 | obs_handler.process_multi_sub_op(v) |
| 556 | self._results[k] = ExistsResult(v) |
| 557 | |
| 558 | @property |
| 559 | def all_ok(self) -> bool: |
nothing calls this directly
no test coverage detected