add extension.code field to BatchItemNotFoundError
#34
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.
Right now,
dataloader-codegenwill throw error when the number of items inrequestandresponseare not the same. see https://github.com/Yelp/dataloader-codegen/blob/master/src/implementation.ts#L249-L254But given the nature of different implementation of resources(endpoints), developers using
dataloader-codegenmight want to catch this error in some cases.For example, there is a resource named
getUserMessage, it returns an empty array whenuserNotExist, this is an expected behaviour of the resource, butdataloader-codegenwill throw aBatchItemNotFoundError. Developers may want to catch this error and return 0.So, in this PR, I am going to export
BatchItemNotFoundErrorerror, so that developers will be able to catch this kind of error and return the default value they want.