MCPcopy Index your code
hub / github.com/couchbase/couchbase-python-client / build_exception

Method build_exception

couchbase/exceptions.py:2083–2114  ·  view source on GitHub ↗
(cls,
                        base_exc,  # type: pycbc_exception
                        mapping=None,  # type: Dict[str, CouchbaseException]
                        )

Source from the content-addressed store, hash-verified

2081
2082 @classmethod
2083 def build_exception(cls,
2084 base_exc, # type: pycbc_exception
2085 mapping=None, # type: Dict[str, CouchbaseException]
2086 ) -> CouchbaseException:
2087 exc_class = None
2088 err_ctx = None
2089 ctx = base_exc.error_context()
2090 if ctx is None:
2091 exc_class = PYCBC_ERROR_MAP.get(base_exc.err(), CouchbaseException)
2092 err_info = base_exc.error_info()
2093 else:
2094 err_ctx = ErrorContext.from_dict(**ctx)
2095 err_info = base_exc.error_info()
2096
2097 if isinstance(err_ctx, HTTPErrorContext):
2098 exc_class = ErrorMapper._parse_http_context(err_ctx, mapping, err_info=err_info)
2099
2100 if isinstance(err_ctx, KeyValueErrorContext):
2101 if mapping is None:
2102 mapping = KV_ERROR_CONTEXT_MAPPING
2103 exc_class = ErrorMapper._parse_kv_context(err_ctx, mapping)
2104
2105 if isinstance(err_ctx, QueryErrorContext):
2106 if mapping is None:
2107 mapping = QUERY_ERROR_MAPPING
2108 exc_class = ErrorMapper._parse_http_context(err_ctx, mapping)
2109
2110 if exc_class is None:
2111 exc_class = PYCBC_ERROR_MAP.get(base_exc.err(), CouchbaseException)
2112
2113 exc = exc_class(base=base_exc, exc_info=err_info, context=err_ctx)
2114 return exc

Callers 15

_get_next_rowMethod · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
_get_next_rowMethod · 0.80
_get_next_rowMethod · 0.80
_get_next_rowMethod · 0.80
wrapped_fnMethod · 0.80
__init__Method · 0.80
_handle_exceptionMethod · 0.80
_set_metadataMethod · 0.80

Calls 5

error_contextMethod · 0.80
from_dictMethod · 0.80
_parse_http_contextMethod · 0.80
_parse_kv_contextMethod · 0.80
getMethod · 0.45