-
Notifications
You must be signed in to change notification settings - Fork 15
Attempt to streamline UI for various error cases #1626
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { ErrorInfo } from "@/components/error-info"; | ||
|
|
||
| export function ENSNodeConnectionError({ error }: { error: Error }) { | ||
| return ( | ||
| <ErrorInfo | ||
| title="Unable to connect to ENSNode" | ||
| description={`Please check your connection settings and try again. Error: ${error.message}`} | ||
| /> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ import type { PropsWithChildren } from "react"; | |||
|
|
||||
| import { useENSNodeConfig } from "@ensnode/ensnode-react"; | ||||
|
|
||||
| import { ENSNodeConnectionError } from "@/components/connections/connection-error"; | ||||
| import { ErrorInfo } from "@/components/error-info"; | ||||
|
||||
| import { ErrorInfo } from "@/components/error-info"; |
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.
Copilot
AI
Feb 10, 2026
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.
ENSNodeConnectionError always renders the title "Unable to connect to ENSNode", but here the error being surfaced is "Unable to parse ENSNode Config". This makes the UI message inconsistent; either keep using ErrorInfo for config-parse failures or make ENSNodeConnectionError accept an overridable title/description.
Copilot
AI
Feb 10, 2026
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.
Wrapping error in new Error(...) drops the original error object (stack/cause). Consider either passing the original error through to ENSNodeConnectionError (and letting it format unknowns safely), or construct the new error with { cause: error } so debugging info is preserved.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import type { PropsWithChildren } from "react"; | |
|
|
||
| import { ENSNodeProvider } from "@ensnode/ensnode-react"; | ||
|
|
||
| import { ENSNodeConnectionError } from "@/components/connections/connection-error"; | ||
| import { useSelectedConnection } from "@/hooks/active/use-selected-connection"; | ||
|
|
||
| /** | ||
|
|
@@ -17,14 +18,18 @@ import { useSelectedConnection } from "@/hooks/active/use-selected-connection"; | |
| * | ||
| * @param children - React children to render within the provider context | ||
| */ | ||
| export function SelectedENSNodeProvider({ children }: PropsWithChildren) { | ||
| export function SelectedENSNodeProvider({ | ||
| header, | ||
| children, | ||
| }: PropsWithChildren<{ header: React.ReactNode }>) { | ||
|
Comment on lines
19
to
+24
|
||
| const selectedConnection = useSelectedConnection(); | ||
|
|
||
| if (selectedConnection.validatedSelectedConnection.isValid) { | ||
| return ( | ||
| <ENSNodeProvider | ||
| config={{ client: { url: selectedConnection.validatedSelectedConnection.url } }} | ||
| > | ||
| {header} | ||
| {children} | ||
| </ENSNodeProvider> | ||
| ); | ||
|
|
@@ -35,10 +40,19 @@ export function SelectedENSNodeProvider({ children }: PropsWithChildren) { | |
| // is in an invalid format. | ||
|
|
||
| return ( | ||
| <div> | ||
| Invalid connection: "{selectedConnection.rawSelectedConnection}" ( | ||
| {selectedConnection.validatedSelectedConnection.error}) | ||
| </div> | ||
| <> | ||
| {header} | ||
|
|
||
| <section className="p-6"> | ||
| <ENSNodeConnectionError | ||
| error={ | ||
| new Error( | ||
| `Invalid connection: "${selectedConnection.rawSelectedConnection}" (${selectedConnection.validatedSelectedConnection.error})`, | ||
| ) | ||
| } | ||
| /> | ||
| </section> | ||
| </> | ||
| ); | ||
| } | ||
| } | ||
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.
ENSNodeConnectionErrorhard-codes the title and formats the full error message into the description, which makes it awkward to reuse for non-connection failures (e.g. config parse errors). Consider accepting optionaltitle/descriptionoverrides (or anErrorInfoPropspassthrough) so callers can keep messaging accurate while still sharing the layout.