Skip to content
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

[@kadena/graph] Normalized error handling #1160

Merged
merged 12 commits into from
Nov 6, 2023
Merged

Conversation

MRVDH
Copy link
Contributor

@MRVDH MRVDH commented Nov 1, 2023

This PR contains several things:

  • We have a function that checks what type of error is being thrown, and formats them to a normalised error message, since we have errors coming from multiple systems, not just one.
  • Since chainweb-node and kadena/client don't throw clear messages, we try to infer the type and the meaning of the error based on the error object we get.
  • We will keep adding different types of errors and their infered meanings the more we find.

Copy link

changeset-bot bot commented Nov 1, 2023

🦋 Changeset detected

Latest commit: 1d36f9e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@kadena/graph-client Patch
@kadena/graph Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Nov 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
alpha-docs ⬜️ Ignored (Inspect) Visit Preview Nov 6, 2023 1:17pm
docs-storybook ⬜️ Ignored (Inspect) Visit Preview Nov 6, 2023 1:17pm
react-ui ⬜️ Ignored (Inspect) Visit Preview Nov 6, 2023 1:17pm
tools ⬜️ Ignored (Inspect) Visit Preview Nov 6, 2023 1:17pm

@nil-amrutlal
Copy link
Contributor

Looks quite good to me 🙌🏽🙌🏽
Taking into account the difficulties in type safety and the different types of responses we can have, I don't see a better way of uniformizing error handling

@MRVDH MRVDH changed the title [@kadena/graph] POC normalized error handling [@kadena/graph] Normalized error handling Nov 3, 2023
@MRVDH MRVDH marked this pull request as ready for review November 3, 2023 07:59
@MRVDH MRVDH requested a review from alber70g as a code owner November 3, 2023 07:59
@nil-amrutlal
Copy link
Contributor

There's some conflicts to be resolved, but apart from that everything looks good 🚀 🙌🏽

@nil-amrutlal
Copy link
Contributor

General remark: Should we maybe add a timeout to the subscriptions?
In the graph-client it just stays in loading state if a certain non-existing request-key is the input. Maybe a timeout, with an error message and a 'Try again' button would be nice?
Also some validation on the input of the request key would be nice. At the moment I can search for 123 as request key (when we know it has a defined length).

I think all these are out of scope but just things I noticed while testing these changes.

@@ -1,23 +1,17 @@
require('module-alias/register');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be done with import?

Suggested change
require('module-alias/register');
import('module-alias/register');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can, but the auto sort for imports will move it down. For now it's okay, but it will break if an import is sorted above it that uses module aliases.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good one. Yes we can ignore the auto-fix I think?
This is one of the reasons we used to have a custom order. Sometimes you need a order when importing like that.

What happens when you use import 'module-alias/register'?

packages/apps/graph/tsconfig.json Outdated Show resolved Hide resolved
@MRVDH MRVDH merged commit cfcd238 into main Nov 6, 2023
10 checks passed
@MRVDH MRVDH deleted the feat/graph/error-handling-poc branch November 6, 2023 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants