Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return better error message when POST request value too large #870

Open
krowvin opened this issue Sep 6, 2024 · 2 comments
Open

Return better error message when POST request value too large #870

krowvin opened this issue Sep 6, 2024 · 2 comments
Labels
approved-W192HQ23F0232-task4 Only valid if set by MikeNeilson priority:medium We care, and will try and get to it soon.

Comments

@krowvin
Copy link
Collaborator

krowvin commented Sep 6, 2024

Not sure about all the other endpoints. But need to catch when a POST request value is too large and let the user know.

In this example case I was gunning for it just to see what happens.

 Caused by: java.sql.SQLException: ORA-12899: value too large for column "CWMS_20"."AT_API_KEYS"."KEY_NAME" (actual: 235, maximum: 64)
curl -X 'POST' \
 'T7IP:TCport/swf-data/auth/keys' \
 -H 'accept: application/json' \
 -H 'Content-Type: application/json' \
 -d '{
 "user-id": "myuserid",
 "key-name": "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat beatae dolore perferendis pariatur reiciendis temporibus? Maxime, aperiam perferendis, modi, reiciendis qui expedita repellat ea adipisci omnis laboriosam in! Reprehenderit, modi?
Impedit, quidem earum ducimus, sequi reprehenderit voluptate magni omnis, mollitia harum excepturi nesciunt nobis amet doloribus voluptatum? Dignissimos facere, voluptatum excepturi id, ipsam dolore asperiores, quibusdam ducimus doloribus magnam aliquid?"
}'

This error message is too generic. What if you have 65 instead of 64?

{
  "message": "System Error",
  "incidentIdentifier": "-8721545769261696166",
  "details": {}
}
@rma-rripken
Copy link
Collaborator

There are at least two ways this could be addressed.

  1. maxLength can be validated in the DTO validate() methods
  2. We can look for "value too large for column" and return a more specific exception

@MikeNeilson
Copy link
Contributor

#2 would probably be the "best" option overall, and certainly works in this case. But given @DanielTOsborne 's update to #849 I don't think it's going to work in every case (though it should)

So I think we're looking at a combination of 1 and 2. Should give us the bulk of things.
However, we did rename some columns so they make more sense. Probably don't need to address that complexity immediately but it's going to come up.

@MikeNeilson MikeNeilson added priority:medium We care, and will try and get to it soon. approved-W192HQ23F0232-task4 Only valid if set by MikeNeilson labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved-W192HQ23F0232-task4 Only valid if set by MikeNeilson priority:medium We care, and will try and get to it soon.
Projects
Status: To triage
Status: Todo
Development

No branches or pull requests

3 participants