Skip to content

Commit

Permalink
fix: write more concise messages about ipfs latency errors
Browse files Browse the repository at this point in the history
  • Loading branch information
1M4nt0 committed Oct 16, 2023
1 parent 3c247a3 commit 4c09176
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
5 changes: 3 additions & 2 deletions packages/wagmi/src/hooks/api/useCreateCredential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ export const useCreateCredential = () => {
})

if (!response.ok) {
const responseJSON = await response.json()
throw new Error(responseJSON.message)
throw new Error(
'There is a problem creating credential. This may be due to high latency of the ipfs node. Please try again in a few minutes.',
)
}

mutate(
Expand Down
15 changes: 4 additions & 11 deletions packages/wagmi/src/hooks/web3/useCreateCourse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export function useCreateCourse({
})

if (!uploadMetadataResponse.ok) {
throw new Error('Error uploading course metadata to IPFS')
throw new Error(
'There is a problem uploading course metadata. This may be due to high latency of the ipfs node. Please try again in a few minutes.',
)
}

setStep(1)
Expand All @@ -121,16 +123,7 @@ export function useCreateCourse({
!uploadMetadataResponseJson.data?.metadata.url
) {
throw new Error(
'There is a problem uploading your metadata. Try again.',
)
}
const metadataResponse = await fetch(
uploadMetadataResponseJson.data.metadata.url,
)

if (!metadataResponse.ok) {
throw new Error(
'There is a problem uploading your metadata. Try again.',
'There is a problem uploading your uploaded course metadata. Please try again in a few minutes.',
)
}

Expand Down

0 comments on commit 4c09176

Please sign in to comment.