Skip to content

fix: don't assume 422 are validation errors#80

Merged
konstantinoscs merged 2 commits intodevelopfrom
feature/tow-752-show-correct-error-message-in-cli-when-users-reach-their
Aug 22, 2025
Merged

fix: don't assume 422 are validation errors#80
konstantinoscs merged 2 commits intodevelopfrom
feature/tow-752-show-correct-error-message-in-cli-when-users-reach-their

Conversation

@konstantinoscs
Copy link
Contributor

@konstantinoscs konstantinoscs commented Aug 19, 2025

Until now, all UNPROCESSABLE_ENTITY errors were assumed to be validation errors. With quotas, that's no longer true.

We need to change the way we process errors a bit.

Example:

grafik

@konstantinoscs konstantinoscs requested a review from bradhe August 19, 2025 13:19
@konstantinoscs konstantinoscs force-pushed the feature/tow-752-show-correct-error-message-in-cli-when-users-reach-their branch from f887b48 to df46de8 Compare August 19, 2025 16:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes error handling to properly display all UNPROCESSABLE_ENTITY errors instead of assuming they're all validation errors. With the introduction of quotas, 422 status codes can now represent different types of errors beyond validation failures.

  • Refactors error output logic to extract and display full error details from API responses
  • Changes UNPROCESSABLE_ENTITY error messaging from validation-specific to generic
  • Updates error content extraction to use actual response content instead of error string representation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/tower-cmd/src/util/apps.rs Updates error content extraction to use response content instead of error string
crates/tower-cmd/src/output.rs Refactors error handling to display full error details and removes validation-specific messaging

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}
}
}
error("The request was syntactically correct, but the Tower API couldn't process it.");
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message is confusing because 'syntactically correct' typically refers to syntax parsing, but UNPROCESSABLE_ENTITY (422) usually means the request was well-formed but semantically invalid. Consider a clearer message like 'The request could not be processed due to semantic errors or business rule violations.'

Suggested change
error("The request was syntactically correct, but the Tower API couldn't process it.");
error("The request could not be processed due to semantic errors or business rule violations.");

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with changing this I guess. Tower hivemind drop your opinion as well...

@konstantinoscs konstantinoscs requested a review from bradhe August 19, 2025 17:31
@konstantinoscs konstantinoscs force-pushed the feature/tow-752-show-correct-error-message-in-cli-when-users-reach-their branch from df46de8 to c277051 Compare August 22, 2025 09:48
Copy link
Contributor

@bradhe bradhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed on a Hangout and this approach will work well for now!

@konstantinoscs konstantinoscs merged commit 5d49d2c into develop Aug 22, 2025
4 checks passed
@konstantinoscs konstantinoscs deleted the feature/tow-752-show-correct-error-message-in-cli-when-users-reach-their branch August 22, 2025 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants