def _ToDbApiException(sql_exception):
  exception = _ERROR_CODE_TO_EXCEPTION.get(sql_exception.code)
  if not exception:
    if sql_exception.code < 1000:
      exception = InternalError
    else:
      exception = OperationalError
  return exception(sql_exception.code, sql_exception.message)
Returns a DB-API exception type appropriate for the given sql_exception.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/storage/speckle/python/api/rdbms.py/_ToDbApiException