1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Revert "error handling updates"

This reverts commit 78b73800d3.
This commit is contained in:
Bogdan Fazakas 2023-10-11 12:02:09 +03:00
parent 78b73800d3
commit e8d96c159e
10 changed files with 21 additions and 23 deletions

View File

@ -193,7 +193,7 @@ export async function getOrderPriceAndFees(
customProviderUrl || asset?.services[0].serviceEndpoint customProviderUrl || asset?.services[0].serviceEndpoint
)) ))
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Initialize Provider] Error:', message) LoggerInstance.error('[Initialize Provider] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -148,7 +148,7 @@ export async function getComputeEnviroment(
if (!computeEnvs[asset.chainId][0]) return null if (!computeEnvs[asset.chainId][0]) return null
return computeEnvs[asset.chainId][0] return computeEnvs[asset.chainId][0]
} catch (e) { } catch (e) {
const message = getErrorMessage(e.message) const message = getErrorMessage(JSON.parse(e.message))
LoggerInstance.error( LoggerInstance.error(
'[Compute to Data] Fetch compute environment:', '[Compute to Data] Fetch compute environment:',
message message
@ -261,7 +261,7 @@ async function getJobs(
}) })
} }
} catch (err) { } catch (err) {
const message = getErrorMessage(err.message) const message = getErrorMessage(JSON.parse(err.message))
LoggerInstance.error('[Compute to Data] Error:', message) LoggerInstance.error('[Compute to Data] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -113,7 +113,7 @@ export async function setNftMetadata(
signal signal
) )
} catch (err) { } catch (err) {
const message = getErrorMessage(err.message) const message = getErrorMessage(JSON.parse(err.message))
LoggerInstance.error('[Encrypt Data] Error:', message) LoggerInstance.error('[Encrypt Data] Error:', message)
toast.error(message) toast.error(message)
} }
@ -155,7 +155,7 @@ export async function setNFTMetadataAndTokenURI(
signal signal
) )
} catch (err) { } catch (err) {
const message = getErrorMessage(err.message) const message = getErrorMessage(JSON.parse(err.message))
LoggerInstance.error('[Encrypt Data] Error:', message) LoggerInstance.error('[Encrypt Data] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -40,7 +40,7 @@ async function initializeProvider(
) )
return provider return provider
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.log('[Initialize Provider] Error:', message) LoggerInstance.log('[Initialize Provider] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -57,7 +57,7 @@ export async function initializeProviderForCompute(
accountId accountId
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Initialize Provider] Error:', message) LoggerInstance.error('[Initialize Provider] Error:', message)
toast.error(message) toast.error(message)
return null return null
@ -79,7 +79,7 @@ export async function getEncryptedFiles(
) )
return response return response
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Provider Encrypt] Error:', message) LoggerInstance.error('[Provider Encrypt] Error:', message)
toast.error(message) toast.error(message)
} }
@ -100,10 +100,9 @@ export async function getFileDidInfo(
) )
return response return response
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Initialize check file did] Error:', message) LoggerInstance.error('[Initialize check file did] Error:', message)
toast.error(`[Initialize check file did] Error: ${message}`) toast.error(message)
throw new Error(`[Initialize check file did] Error: ${message}`)
} }
} }
@ -138,7 +137,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl customProviderUrl || providerUrl
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Provider Get File info] Error:', message) LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message) toast.error(message)
} }
@ -155,7 +154,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl customProviderUrl || providerUrl
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Provider Get File info] Error:', message) LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message) toast.error(message)
} }
@ -174,7 +173,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl customProviderUrl || providerUrl
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Provider Get File info] Error:', message) LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message) toast.error(message)
} }
@ -194,7 +193,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl customProviderUrl || providerUrl
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Provider Get File info] Error:', message) LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message) toast.error(message)
} }
@ -214,7 +213,7 @@ export async function getFileInfo(
customProviderUrl || providerUrl customProviderUrl || providerUrl
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Provider Get File info] Error:', message) LoggerInstance.error('[Provider Get File info] Error:', message)
toast.error(message) toast.error(message)
} }
@ -243,7 +242,7 @@ export async function downloadFile(
userCustomParameters userCustomParameters
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Provider Get download url] Error:', message) LoggerInstance.error('[Provider Get download url] Error:', message)
toast.error(message) toast.error(message)
} }
@ -257,7 +256,7 @@ export async function checkValidProvider(
const response = await ProviderInstance.isValidProvider(providerUrl) const response = await ProviderInstance.isValidProvider(providerUrl)
return response return response
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Provider Check] Error:', message) LoggerInstance.error('[Provider Check] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -76,7 +76,7 @@ export default function CustomProvider(props: InputProps): ReactElement {
// if all good, add provider to formik state // if all good, add provider to formik state
helpers.setValue({ url: field.value.url, valid: isValid, custom: true }) helpers.setValue({ url: field.value.url, valid: isValid, custom: true })
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
setFieldError(`${field.name}.url`, message) setFieldError(`${field.name}.url`, message)
LoggerInstance.error('[Custom Provider]:', message) LoggerInstance.error('[Custom Provider]:', message)
} finally { } finally {

View File

@ -439,7 +439,7 @@ export default function Compute({
setRefetchJobs(!refetchJobs) setRefetchJobs(!refetchJobs)
initPriceAndFees() initPriceAndFees()
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Compute] Error:', message) LoggerInstance.error('[Compute] Error:', message)
setError(message) setError(message)
setRetry(true) setRetry(true)

View File

@ -95,7 +95,6 @@ export default function AssetActions({
setFileIsLoading(false) setFileIsLoading(false)
} catch (error) { } catch (error) {
setFileIsLoading(false)
LoggerInstance.error(error.message) LoggerInstance.error(error.message)
} }
} }

View File

@ -72,7 +72,7 @@ export default function Results({
) )
await downloadFileBrowser(jobResult) await downloadFileBrowser(jobResult)
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Provider Get c2d results url] Error:', message) LoggerInstance.error('[Provider Get c2d results url] Error:', message)
toast.error(message) toast.error(message)
} }

View File

@ -149,7 +149,7 @@ export default function PublishPage({
newAbortController() newAbortController()
) )
} catch (error) { } catch (error) {
const message = getErrorMessage(error.message) const message = getErrorMessage(JSON.parse(error.message))
LoggerInstance.error('[Provider Encrypt] Error:', message) LoggerInstance.error('[Provider Encrypt] Error:', message)
} }