-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add support for better error handling + provide API documentation #46
Conversation
4d099e1
to
9500759
Compare
@@ -355,6 +481,74 @@ test('batch endpoint (multiple requests, error handling)', async () => { | |||
}); | |||
}); | |||
|
|||
test('batch endpoint (multiple requests, custom error handling)', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++, nice test
@@ -292,7 +292,133 @@ test('batch endpoint (multiple requests)', async () => { | |||
}); | |||
}); | |||
|
|||
test('batch endpoint (multiple requests, error handling)', async () => { | |||
test('batch endpoint that throws errors', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++, nice test.
Could we add one more test when the number of items are not match in request/response
then throw BatchItemNotFound
Error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have these tests:
test('batch endpoint without reorderResultsByKey throws error for response with non existant items', async () => { test('batch endpoint with reorderResultsByKey handles response with non existant items', async () => {
I've gone ahead and asserted that these are actually BatchItemNotFound
errors now tho :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could probably do with some better organization of these tests :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Could be great to add more tests and make test
fail on CI. We may need to run make test
to meet the requirement of pre-commit hooks.
This ended up being kind of two seperate efforts in one PR, sorry! Here's what's happening: - Add API_DOCS.md to provide full documentation for all of dataloader-codegen's options - Add some default error handling in the case that a resource returns an error - we don't want to blow up the whole batch - Add a new `errorHandler` option to the config to let folks override what happens to an error returned from a resource
9500759
to
2e8f530
Compare
This ended up being kind of two seperate efforts in one PR, sorry! 😬
Here's what's happening:
errorHandler
option to the config to let folks override what happens to an error returned from a resource