Skip to content

Commit

Permalink
[Function] Optimise an error when function deletion is failed (#5646)
Browse files Browse the repository at this point in the history
  • Loading branch information
rokatyy authored Jun 2, 2024
1 parent 9925236 commit 3ef9bb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions server/api/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ async def _delete_function(
auth_info, project, nuclio_function_names
)
if failed_requests:
error_message = f"Failed to delete function {function_name}. Errors: {' '.join(failed_requests)}"
error_message = f"Failed to delete function {function_name}. Errors: {';'.join(failed_requests)}"
await _update_functions_with_deletion_info(
functions, project, {"status.deletion_error": error_message}
)
Expand Down Expand Up @@ -1396,8 +1396,6 @@ async def delete_function(
if isinstance(result, tuple):
nuclio_name, error_message = result
if error_message:
failed_requests.append(
f"Failed to delete nuclio function {nuclio_name}: {error_message}"
)
failed_requests.append(error_message)

return failed_requests
4 changes: 3 additions & 1 deletion server/api/utils/clients/async_nuclio.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ def _handle_error_response(

self._logger.warning("Request to nuclio failed. Reason:", **log_kwargs)

mlrun.errors.raise_for_status(response, error_message)
raise mlrun.errors.STATUS_ERRORS[response.status](
error_message, response=response
)

def _enrich_nuclio_api_gateway(
self,
Expand Down

0 comments on commit 3ef9bb6

Please sign in to comment.