From 06b6595ace5f49e5c1bbc94fc64642b74cac453e Mon Sep 17 00:00:00 2001 From: Martin Minkov Date: Fri, 23 Feb 2024 11:22:36 -0800 Subject: [PATCH 1/4] fix(fetch.ts): update error message for undefined GraphQL endpoint to provide more specific guidance on how to resolve the issue --- src/lib/fetch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/fetch.ts b/src/lib/fetch.ts index 73d324770d..aaa942fd1b 100644 --- a/src/lib/fetch.ts +++ b/src/lib/fetch.ts @@ -690,7 +690,7 @@ async function fetchActions( ) { if (!graphqlEndpoint) throw new Error( - 'fetchActions: Specified GraphQL endpoint is undefined. Please specify a valid endpoint.' + 'fetchActions: Specified GraphQL endpoint is undefined. When using actions, you must set the archive node endpoint in Mina.Network(). Please ensure your Mina.Network() configuration includes an archive node endpoint.' ); const { publicKey, From 902202fa5a55bae4e4402cf70d399f9b1e922e26 Mon Sep 17 00:00:00 2001 From: Martin Minkov Date: Fri, 23 Feb 2024 11:23:41 -0800 Subject: [PATCH 2/4] refactor(fetch.ts): replace 'new Error' with 'Error' for throwing exceptions to follow best practices --- src/lib/fetch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/fetch.ts b/src/lib/fetch.ts index aaa942fd1b..4a3e38067e 100644 --- a/src/lib/fetch.ts +++ b/src/lib/fetch.ts @@ -689,7 +689,7 @@ async function fetchActions( graphqlEndpoint = networkConfig.archiveEndpoint ) { if (!graphqlEndpoint) - throw new Error( + throw Error( 'fetchActions: Specified GraphQL endpoint is undefined. When using actions, you must set the archive node endpoint in Mina.Network(). Please ensure your Mina.Network() configuration includes an archive node endpoint.' ); const { From 1a6aa9b28733dc5e11a9c553ad0d91999144617c Mon Sep 17 00:00:00 2001 From: Martin Minkov Date: Fri, 23 Feb 2024 11:24:51 -0800 Subject: [PATCH 3/4] docs(CHANGELOG.md): add entry for improved error message for missing Archive Node endpoint in fetchActions This commit adds a new entry in the changelog to document the improvement of the error message when trying to use `fetchActions` with a missing Archive Node endpoint. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07f9ad9c53..21a6579941 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Improve all-around performance by reverting the Apple silicon workaround (https://github.com/o1-labs/o1js/pull/683) as the root problem is now fixed upstream https://github.com/o1-labs/o1js/pull/1456 +- Improved error message when trying to use `fetchActions` with a missing Archive Node endpoint https://github.com/o1-labs/o1js/pull/1459 ### Deprecated From 2e7395a5b4837da6442628c844bc35133f588c31 Mon Sep 17 00:00:00 2001 From: Martin Minkov Date: Fri, 23 Feb 2024 11:30:40 -0800 Subject: [PATCH 4/4] fix(fetch.ts): improve error message for undefined GraphQL endpoint in fetchEvents --- CHANGELOG.md | 2 +- src/lib/fetch.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21a6579941..1a99323c9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Improve all-around performance by reverting the Apple silicon workaround (https://github.com/o1-labs/o1js/pull/683) as the root problem is now fixed upstream https://github.com/o1-labs/o1js/pull/1456 -- Improved error message when trying to use `fetchActions` with a missing Archive Node endpoint https://github.com/o1-labs/o1js/pull/1459 +- Improved error message when trying to use `fetchActions`/`fetchEvents` with a missing Archive Node endpoint https://github.com/o1-labs/o1js/pull/1459 ### Deprecated diff --git a/src/lib/fetch.ts b/src/lib/fetch.ts index 4a3e38067e..e357579501 100644 --- a/src/lib/fetch.ts +++ b/src/lib/fetch.ts @@ -640,8 +640,8 @@ async function fetchEvents( filterOptions: EventActionFilterOptions = {} ) { if (!graphqlEndpoint) - throw new Error( - 'fetchEvents: Specified GraphQL endpoint is undefined. Please specify a valid endpoint.' + throw Error( + 'fetchEvents: Specified GraphQL endpoint is undefined. When using events, you must set the archive node endpoint in Mina.Network(). Please ensure your Mina.Network() configuration includes an archive node endpoint.' ); const { publicKey, tokenId } = accountInfo; let [response, error] = await makeGraphqlRequest(