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

Fix infinite loading on file info #1977

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 92 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@coingecko/cryptoformat": "^0.5.4",
"@loadable/component": "^5.15.2",
"@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^3.0.4",
"@oceanprotocol/lib": "^3.1.3-next.1",
"@oceanprotocol/typographies": "^0.1.0",
"@oceanprotocol/use-dark-mode": "^2.4.3",
"@orbisclub/orbis-sdk": "^0.4.40",
Expand Down
2 changes: 1 addition & 1 deletion src/@utils/accessDetailsAndPricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export async function getOrderPriceAndFees(
customProviderUrl || asset?.services[0].serviceEndpoint
))
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Initialize Provider] Error:', message)
toast.error(message)
}
Expand Down
4 changes: 2 additions & 2 deletions src/@utils/compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export async function getComputeEnviroment(
if (!computeEnvs[asset.chainId][0]) return null
return computeEnvs[asset.chainId][0]
} catch (e) {
const message = getErrorMessage(JSON.parse(e.message))
const message = getErrorMessage(e.message)
LoggerInstance.error(
'[Compute to Data] Fetch compute environment:',
message
Expand Down Expand Up @@ -261,7 +261,7 @@ async function getJobs(
})
}
} catch (err) {
const message = getErrorMessage(JSON.parse(err.message))
const message = getErrorMessage(err.message)
LoggerInstance.error('[Compute to Data] Error:', message)
toast.error(message)
}
Expand Down
4 changes: 2 additions & 2 deletions src/@utils/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export async function setNftMetadata(
signal
)
} catch (err) {
const message = getErrorMessage(JSON.parse(err.message))
const message = getErrorMessage(err.message)
LoggerInstance.error('[Encrypt Data] Error:', message)
toast.error(message)
}
Expand Down Expand Up @@ -155,7 +155,7 @@ export async function setNFTMetadataAndTokenURI(
signal
)
} catch (err) {
const message = getErrorMessage(JSON.parse(err.message))
const message = getErrorMessage(err.message)
LoggerInstance.error('[Encrypt Data] Error:', message)
toast.error(message)
}
Expand Down
2 changes: 1 addition & 1 deletion src/@utils/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function initializeProvider(
)
return provider
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.log('[Initialize Provider] Error:', message)
toast.error(message)
}
Expand Down
23 changes: 12 additions & 11 deletions src/@utils/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function initializeProviderForCompute(
accountId
)
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Initialize Provider] Error:', message)
toast.error(message)
return null
Expand All @@ -79,7 +79,7 @@ export async function getEncryptedFiles(
)
return response
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Encrypt] Error:', message)
toast.error(message)
}
Expand All @@ -100,9 +100,10 @@ export async function getFileDidInfo(
)
return response
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Initialize check file did] Error:', message)
toast.error(message)
toast.error(`[Initialize check file did] Error: ${message}`)
throw new Error(`[Initialize check file did] Error: ${message}`)
}
}

Expand Down Expand Up @@ -137,7 +138,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl
)
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message)
}
Expand All @@ -154,7 +155,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl
)
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message)
}
Expand All @@ -173,7 +174,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl
)
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message)
}
Expand All @@ -193,7 +194,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl
)
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message)
}
Expand All @@ -213,7 +214,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl
)
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message)
}
Expand Down Expand Up @@ -242,7 +243,7 @@ export async function downloadFile(
userCustomParameters
)
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get download url] Error:', message)
toast.error(message)
}
Expand All @@ -256,7 +257,7 @@ export async function checkValidProvider(
const response = await ProviderInstance.isValidProvider(providerUrl)
return response
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Check] Error:', message)
toast.error(message)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function CustomProvider(props: InputProps): ReactElement {
// if all good, add provider to formik state
helpers.setValue({ url: field.value.url, valid: isValid, custom: true })
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
setFieldError(`${field.name}.url`, message)
LoggerInstance.error('[Custom Provider]:', message)
} finally {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Asset/AssetActions/Compute/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export default function Compute({
setRefetchJobs(!refetchJobs)
initPriceAndFees()
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Compute] Error:', message)
setError(message)
setRetry(true)
Expand Down
1 change: 1 addition & 0 deletions src/components/Asset/AssetActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default function AssetActions({

setFileIsLoading(false)
} catch (error) {
setFileIsLoading(false)
LoggerInstance.error(error.message)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Profile/History/ComputeJobs/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function Results({
)
await downloadFileBrowser(jobResult)
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Get c2d results url] Error:', message)
toast.error(message)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Publish/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default function PublishPage({
newAbortController()
)
} catch (error) {
const message = getErrorMessage(JSON.parse(error.message))
const message = getErrorMessage(error.message)
LoggerInstance.error('[Provider Encrypt] Error:', message)
}

Expand Down
Loading