You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In situations where the Octopus Server returns an error, the core.APIErrorChecker function is run to validate the response.
This function has a hardcoded error template string format of "octopus deploy api returned an error on endpoint %s - %s", urlPath, octopusDeployError.Errors
Note: octopusDeployError.Errors is a []string, representing a JSON array that the server sent us in the error response.
This results in a caller, (e.g. the CLI) receiving a string such as the following:
octopus deploy api returned an error on endpoint /api/Spaces-1/releases/create/v1 - [Release '5.0.2' already exists for this project. Please use a different version, or look at using a mask to auto-increment the number.]
This is not particularly friendly for end-user display. The brute force option would be to regex or string-split to pull out the contents inside the [], however this is incredibly brittle.
My preferred option would be to have the APIErrorChecker return a richer error struct, which contained the server-sent strings in an array that could be accessed by the caller. This would enable the CLI to simply print the server-sent error: Release '5.0.2' already exists for this project. Please use a different version, or look at using a mask to auto-increment the number.
The text was updated successfully, but these errors were encountered:
In situations where the Octopus Server returns an error, the
core.APIErrorChecker
function is run to validate the response.This function has a hardcoded error template string format of
"octopus deploy api returned an error on endpoint %s - %s", urlPath, octopusDeployError.Errors
Note:
octopusDeployError.Errors
is a[]string
, representing a JSON array that the server sent us in the error response.This results in a caller, (e.g. the CLI) receiving a string such as the following:
octopus deploy api returned an error on endpoint /api/Spaces-1/releases/create/v1 - [Release '5.0.2' already exists for this project. Please use a different version, or look at using a mask to auto-increment the number.]
This is not particularly friendly for end-user display. The brute force option would be to regex or string-split to pull out the contents inside the [], however this is incredibly brittle.
My preferred option would be to have the APIErrorChecker return a richer error struct, which contained the server-sent strings in an array that could be accessed by the caller. This would enable the CLI to simply print the server-sent error: Release '5.0.2' already exists for this project. Please use a different version, or look at using a mask to auto-increment the number.
The text was updated successfully, but these errors were encountered: