Skip to content

Commit

Permalink
Add YAML spec docs about matching errors (#89370)
Browse files Browse the repository at this point in the history
It's not obvious that a YAML test with a `catch` stanza also permits
`match` blocks to assert things about the structure of the error
response, but this structure may be an important part of the API spec.
This commit adds this info to the docs about YAML tests.
  • Loading branch information
DaveCTurner committed Aug 18, 2022
1 parent 1403ab3 commit c238aa1
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -320,8 +320,15 @@ be caught and tested. For instance:
catch: missing
get:
index: test
type: test
type: test
id: 1
# And, optionally, you can assert on the contents of the precise contents of the error message:
- match: { error.type: "illegal_argument_exception" }
- match: { error.reason: "The request contained an illegal argument" }
- match: { error.caused_by.reason: "The argument was illegal because ..." }
- match: { error.root_cause.0.type: "illegal_argument_exception" }
....
The argument to `catch` can be any of:
Expand Down

0 comments on commit c238aa1

Please sign in to comment.