herbsjs / herbs2gql

Create a GraphQL endpoint based on Entities and Use Cases
MIT License
14 stars 21 forks source link

feat(defaultresolver): adds support to custom error handler on default resolver #40

Closed euduardo closed 2 years ago

euduardo commented 2 years ago

It adds support to receive a custom error handler on the default resolver. If none is provided, so it uses the default error handler.

fix #23

Proposed Changes

  1. Moved the error handling on defaultResolver to a separated file.
  2. Added a parameter called options on defaultResolver. It has a property called errorHandler that is set to the defaultErrorhandler when none is provided. I decided to receive an options object instead of a simple errorHandler function because it is easier to extends these functionalities (like overriding another behavior) without creating breaking chances or adding more parameters.

Readiness Checklist

Author/Contributor

Reviewing Maintainer

codecov[bot] commented 2 years ago

Codecov Report

Merging #40 (c48c670) into master (ded48a4) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head c48c670 differs from pull request most recent head 4eaaee2. Consider uploading reports for the commit 4eaaee2 to get more accurate results

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #40   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           12        13    +1     
  Lines          164       171    +7     
=========================================
+ Hits           164       171    +7     
Impacted Files Coverage Δ
src/herbs2gql.js 100.00% <ø> (ø)
src/defaultErrorHandler.js 100.00% <100.00%> (ø)
src/defaultResolver.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 49d6b31...4eaaee2. Read the comment docs.

euduardo commented 2 years ago

Hi @euduardo thanks for your contribution!

I think is missing some documentation about how to use this.

You say in the readme? I've written a little bit about how to use this feature there Does this need more details? Or it needs to be done in another place?

jhomarolo commented 2 years ago

Hi @euduardo thanks for your contribution! I think is missing some documentation about how to use this.

You say in the readme? I've written a little bit about how to use this feature there Does this need more details? Or it needs to be done in another place?

Yes, in read.me :)

dalssoft commented 2 years ago

@euduardo tks for the contribuition!

before merge, could you please send a PR documenting this features on the herbs docs? https://github.com/herbsjs/herbsjs.github.io/issues/103

tks

euduardo commented 2 years ago

Readme updated.

Can you please check i out, @jhomarolo ?

jhomarolo commented 2 years ago

:tada: This PR is included in version 2.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

dalssoft commented 2 years ago

Is there a issue open to fix/update herbs site/doc?

eduardo-vortx commented 2 years ago

Is there a issue open to fix/update herbs site/doc?

Yes, issue #23

dalssoft commented 2 years ago

The issue should be opened here: https://github.com/herbsjs/herbsjs.github.io

dalssoft commented 2 years ago

@euduardo do we already have a issue for this doc on our web site? if not I can create for you.

remember that a undocumented feature will not be used by anyone