Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion skyflow/error/_skyflow_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ def __init__(self,
self.http_status = http_status if http_status else SkyflowMessages.HttpStatus.BAD_REQUEST.value
self.details = details
self.request_id = request_id
log_error(message, http_code, request_id, grpc_code, http_status, details)
super().__init__()
4 changes: 2 additions & 2 deletions skyflow/utils/_skyflow_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ErrorCodes(Enum):
REDACTION_WITH_TOKENS_NOT_SUPPORTED = 400

class Error(Enum):
GENERIC_API_ERROR = f"{error_prefix} Validation error. Invalid configuration. Please add a valid vault configuration."
GENERIC_API_ERROR = f"{error_prefix} API error. Error occurred."

EMPTY_VAULT_ID = f"{error_prefix} Initialization failed. Invalid vault Id. Specify a valid vault Id."
INVALID_VAULT_ID = f"{error_prefix} Initialization failed. Invalid vault Id. Specify a valid vault Id as a string."
Expand Down Expand Up @@ -283,7 +283,6 @@ class Info(Enum):
VALIDATING_FILE_UPLOAD_REQUEST = f"{INFO}: [{error_prefix}] Validating file upload request."
FILE_UPLOAD_REQUEST_RESOLVED = f"{INFO}: [{error_prefix}] File upload request resolved."
FILE_UPLOAD_SUCCESS = f"{INFO}: [{error_prefix}] File uploaded successfully."
FILE_UPLOAD_REQUEST_REJECTED = f"{ERROR}: [{error_prefix}] File upload failed."

INVOKE_CONNECTION_TRIGGERED = f"{INFO}: [{error_prefix}] Invoke connection method triggered."
VALIDATING_INVOKE_CONNECTION_REQUEST = f"{INFO}: [{error_prefix}] Validating invoke connection request."
Expand Down Expand Up @@ -351,6 +350,7 @@ class ErrorLogs(Enum):
EMPTY_OR_NULL_VALUE_IN_TOKENS = f"{ERROR}: [{error_prefix}] Invalid {{}} request. Value can not be null or empty in tokens for key {{}}."
EMPTY_OR_NULL_KEY_IN_TOKENS = f"{ERROR}: [{error_prefix}] Invalid {{}} request. Key can not be null or empty in tokens."
MISMATCH_OF_FIELDS_AND_TOKENS = f"{ERROR}: [{error_prefix}] Invalid {{}} request. Keys for values and tokens are not matching."
FILE_UPLOAD_REQUEST_REJECTED = f"{ERROR}: [{error_prefix}] File upload failed."

EMPTY_IDS = f"{ERROR}: [{error_prefix}] Invalid {{}} request. Ids can not be empty."
EMPTY_OR_NULL_ID_IN_IDS = f"{ERROR}: [{error_prefix}] Invalid {{}} request. Id can not be null or empty in ids at index {{}}."
Expand Down
4 changes: 2 additions & 2 deletions skyflow/utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def log_and_reject_error(description, status_code, request_id, http_status=None,

def handle_exception(error, logger):
if isinstance(error, httpx.ConnectError):
description = SkyflowMessages.Error.GENERIC_API_ERROR.value
description = str(error) if error else SkyflowMessages.Error.GENERIC_API_ERROR.value
log_and_reject_error(description, SkyflowMessages.ErrorCodes.INVALID_INPUT.value, None, logger=logger)
return

Expand Down Expand Up @@ -506,7 +506,7 @@ def handle_text_error(err, data, request_id, logger):
log_and_reject_error(data, err.status, request_id, logger = logger)

def handle_generic_error_with_status(err, request_id, status, logger):
description = SkyflowMessages.Error.GENERIC_API_ERROR.value
description = str(err) if err else SkyflowMessages.Error.GENERIC_API_ERROR.value
log_and_reject_error(description, status, request_id, logger=logger)

def encode_column_values(get_request):
Expand Down
8 changes: 4 additions & 4 deletions tests/utils/test__utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def test_handle_exception_connect_error(self, mock_log_and_reject_error):
handle_exception(mock_error, mock_logger)

mock_log_and_reject_error.assert_called_once_with(
SkyflowMessages.Error.GENERIC_API_ERROR.value,
'Connection refused',
SkyflowMessages.ErrorCodes.INVALID_INPUT.value,
None,
logger=mock_logger
Expand Down Expand Up @@ -688,7 +688,7 @@ def test_handle_exception_generic_error_with_status(self, mock_log_and_reject_er
handle_exception(mock_error, mock_logger)

mock_log_and_reject_error.assert_called_once_with(
SkyflowMessages.Error.GENERIC_API_ERROR.value,
str(mock_error),
503,
"1234",
logger=mock_logger
Expand All @@ -706,7 +706,7 @@ def test_handle_exception_no_content_type(self, mock_log_and_reject_error):
handle_exception(mock_error, mock_logger)

mock_log_and_reject_error.assert_called_once_with(
SkyflowMessages.Error.GENERIC_API_ERROR.value,
str(mock_error),
500,
"1234",
logger=mock_logger
Expand Down Expand Up @@ -812,7 +812,7 @@ def test_handle_generic_error_with_status(self, mock_log_and_reject_error):
handle_generic_error_with_status(mock_error, request_id, status, mock_logger)

mock_log_and_reject_error.assert_called_once_with(
SkyflowMessages.Error.GENERIC_API_ERROR.value,
str(mock_error),
503,
request_id,
logger=mock_logger
Expand Down
Loading