Skip to content

Commit

Permalink
Adds try catch to prevent app crashing (#1762)
Browse files Browse the repository at this point in the history
  • Loading branch information
abtestingalpha authored Jan 7, 2024
1 parent d9ae90e commit 410ebdb
Showing 1 changed file with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@ export const useBridgeTxStatus = ({
const getKappa = async (): Promise<string> => {
if (!synapseSDK) return null
if (!bridgeModuleName || !originChainId || !originTxHash) return null
return await synapseSDK.getSynapseTxId(
originChainId,
bridgeModuleName,
originTxHash
)
try {
const kappa = await synapseSDK.getSynapseTxId(
originChainId,
bridgeModuleName,
originTxHash
)
return kappa
} catch (error) {
console.error('Error in getKappa:', error)
return null
}
}

const getBridgeTxStatus = async (
Expand All @@ -42,11 +48,17 @@ export const useBridgeTxStatus = ({
) => {
if (!synapseSDK) return null
if (!destinationChainId || !bridgeModuleName || !kappa) return null
return await synapseSDK.getBridgeTxStatus(
destinationChainId,
bridgeModuleName,
kappa
)
try {
const status = await synapseSDK.getBridgeTxStatus(
destinationChainId,
bridgeModuleName,
kappa
)
return status
} catch (error) {
console.error('Error in getBridgeTxStatus:', error)
return null
}
}

useEffect(() => {
Expand Down

0 comments on commit 410ebdb

Please sign in to comment.