Skip to content

Simplify behavior of FieldResponse#getError to only return the first field error #524

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

Closed
rstoyanchev opened this issue Nov 4, 2022 · 1 comment
Assignees
Labels
type: enhancement A general enhancement

Comments

@rstoyanchev
Copy link
Contributor

rstoyanchev commented Nov 4, 2022

While getErrors in FieldResponse simply returns all field errors, by contrast getError does a more exhaustive search that also includes global, request errors too, but only if the field is "failed" (i.e. has no value). So if the field has both a value and nested field errors, then getError would return null while getErrors would be non-empty.

We should align the two by making getError return the first field error. Separately, one still has the option to check if the field has a value or not, if the GraphQlResponse has global, request errors.

@rstoyanchev rstoyanchev added the type: enhancement A general enhancement label Nov 4, 2022
@rstoyanchev rstoyanchev added this to the 1.1.0 milestone Nov 4, 2022
@rstoyanchev rstoyanchev self-assigned this Nov 4, 2022
@rstoyanchev rstoyanchev changed the title Simplify behavior of FieldResponse#getError to simply return the first field error Simplify behavior of FieldResponse#getError to only return the first field error Nov 4, 2022
@rstoyanchev
Copy link
Contributor Author

On second thought, the more logical thing is to deprecate getError() altogether.

@rstoyanchev rstoyanchev closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2022
@rstoyanchev rstoyanchev removed this from the 1.1.0 milestone Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant