def _DatastoreExceptionFromCanonicalErrorCodeAndDetail(error, detail):
  exception_class = _CLOUD_DATASTORE_EXCEPTION_CLASSES.get(
      error, datastore_errors.InternalError)

  if detail is None:
    return exception_class()
  else:
    return exception_class(detail)
Converts a canonical error code into a datastore_errors.Error.
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/datastore/datastore_rpc.py/_DatastoreExceptionFromCanonicalErrorCodeAndDetail