Merged
Conversation
17d8003 to
dfbbe34
Compare
janl
reviewed
Jul 29, 2023
| {ok, FinalUserAcc1}; | ||
| {ok, Error} when is_tuple(Error) -> | ||
| % fabric_view_all_docs turns {error, Resp} results into {ok, Resp} | ||
| % for some reason. If we didn't get a proper cursor record, assume |
Member
There was a problem hiding this comment.
should we not fix that instead of papering over the odd behaviour? (he said without looking how hard that would be :)
Contributor
Author
There was a problem hiding this comment.
It’s been like that for years and it’s probably expected to return that in other places where all_docs is used. Since we don’t have rigorous tests for error conditions we’d probably break something else.
Add handling for invalid field errors. Previously they would emit a 500
`badmatch` error with a stack trace:
```
% curl -v -XPOST -H'Content-type:application/json' $URL/db/_find -d '{"selector":{"_id":{"":null}}}'
< HTTP/1.1 500 Internal Server Error
{"error":"badmatch","reason":"{error,{{mango_error,mango_util,{invalid_field_name...
```
With the fix it emits a 400 error:
```
< HTTP/1.1 400 Bad Request
{"error":"invalid_field_name","reason":"Invalid field name: _id."}
```
This should also handle a general class of mango errors from `$db/_find` which
are sent from the workers, passed through the fabric/rexi mechanism, and
handled on the coordinator side. Previously some of those would emit the same
500 badmatch + a stack trace since we didn't expect errors in a few places
which generated a `badmatch`.
dfbbe34 to
0560b45
Compare
rnewson
approved these changes
Jul 30, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add handling for invalid field errors. Previously they would emit a 500
badmatcherror with a stack trace:With the fix it emits a 400 error:
This should also handle a general class of mango errors from
$db/_findwhich are sent from the workers, passed through the fabric/rexi mechanism, and handled on the coordinator side. Previously some of those would emit the same 500 badmatch + a stack trace since we didn't expect errors in a few places which generated abadmatch.