diff --git a/libs/deposits/src/lib/use-deposit-balances.ts b/libs/deposits/src/lib/use-deposit-balances.ts index a0836cfc8..02d4f802f 100644 --- a/libs/deposits/src/lib/use-deposit-balances.ts +++ b/libs/deposits/src/lib/use-deposit-balances.ts @@ -63,7 +63,7 @@ export const useDepositBalances = ( }); } catch (err) { const logger = localLoggerFactory({ application: 'deposits' }); - if (err.message.match(/call revert exception/)) { + if ((err as Error).message.match(/call revert exception/)) { logger.info('call revert eth exception', err); } else { logger.error(err); diff --git a/libs/deposits/src/lib/use-get-allowance.ts b/libs/deposits/src/lib/use-get-allowance.ts index e51792f7f..b93702216 100644 --- a/libs/deposits/src/lib/use-get-allowance.ts +++ b/libs/deposits/src/lib/use-get-allowance.ts @@ -26,7 +26,7 @@ export const useGetAllowance = ( return new BigNumber(addDecimal(res.toString(), asset.decimals)); } catch (err) { const logger = localLoggerFactory({ application: 'deposits' }); - if (err.message.match(/call revert exception/)) { + if ((err as Error).message.match(/call revert exception/)) { logger.info('call revert eth exception', err); } else { logger.error(err); diff --git a/libs/deposits/src/lib/use-get-deposit-maximum.ts b/libs/deposits/src/lib/use-get-deposit-maximum.ts index f93e55595..aaac9f0d7 100644 --- a/libs/deposits/src/lib/use-get-deposit-maximum.ts +++ b/libs/deposits/src/lib/use-get-deposit-maximum.ts @@ -20,7 +20,7 @@ export const useGetDepositMaximum = ( return max.isEqualTo(0) ? new BigNumber(Infinity) : max; } catch (err) { const logger = localLoggerFactory({ application: 'deposits' }); - if (err.message.match(/call revert exception/)) { + if ((err as Error).message.match(/call revert exception/)) { logger.info('call revert eth exception', err); } else { logger.error(err); diff --git a/libs/deposits/src/lib/use-get-deposited-amount.ts b/libs/deposits/src/lib/use-get-deposited-amount.ts index 0ee0dc67a..1f22fb800 100644 --- a/libs/deposits/src/lib/use-get-deposited-amount.ts +++ b/libs/deposits/src/lib/use-get-deposited-amount.ts @@ -41,7 +41,7 @@ export const useGetDepositedAmount = (asset: Asset | undefined) => { return new BigNumber(addDecimal(value, asset.decimals)); } catch (err) { const logger = localLoggerFactory({ application: 'deposits' }); - if (err.message.match(/call revert exception/)) { + if ((err as Error).message.match(/call revert exception/)) { logger.info('call revert eth exception', err); } else { logger.error(err); diff --git a/libs/utils/src/lib/local-logger.spec.ts b/libs/utils/src/lib/local-logger.spec.ts index 3dd21c184..02769629d 100644 --- a/libs/utils/src/lib/local-logger.spec.ts +++ b/libs/utils/src/lib/local-logger.spec.ts @@ -1,4 +1,4 @@ -import * as Sentry from '@sentry/browser'; +import * as Sentry from '@sentry/react'; import type { Severity } from '@sentry/types/types/severity'; import { LocalLogger, localLoggerFactory } from './local-logger'; diff --git a/libs/utils/src/lib/local-logger.ts b/libs/utils/src/lib/local-logger.ts index 1525cad65..b5d7a2bf1 100644 --- a/libs/utils/src/lib/local-logger.ts +++ b/libs/utils/src/lib/local-logger.ts @@ -1,4 +1,4 @@ -import * as Sentry from '@sentry/browser'; +import * as Sentry from '@sentry/react'; import type { Scope } from '@sentry/browser'; import type { Severity, Breadcrumb, Primitive } from '@sentry/types'; @@ -13,7 +13,14 @@ const LogLevels = [ 'silent', ]; type LogLevelsType = typeof LogLevels[number]; -type ConsoleArg = string | number | boolean | bigint | symbol | object; +type ConsoleArg = + | string + | number + | boolean + | bigint + | symbol + | object + | unknown; type ConsoleMethod = { [K in keyof Console]: Console[K] extends (...args: ConsoleArg[]) => unknown ? K @@ -110,7 +117,7 @@ export class LocalLogger { if (this.tags.length) { this.tags.forEach((tag) => { const found = args.reduce((aggr, arg) => { - if (typeof arg === 'object' && tag in arg) { + if (arg && typeof arg === 'object' && tag in arg) { // @ts-ignore change object to record aggr = arg[tag] as unknown as Primitive | object; } diff --git a/libs/web3/src/lib/use-get-withdraw-delay.ts b/libs/web3/src/lib/use-get-withdraw-delay.ts index a97f74ac2..62cdf5775 100644 --- a/libs/web3/src/lib/use-get-withdraw-delay.ts +++ b/libs/web3/src/lib/use-get-withdraw-delay.ts @@ -14,7 +14,7 @@ export const useGetWithdrawDelay = () => { return res.toNumber(); } catch (err) { const logger = localLoggerFactory({ application: 'web3' }); - if (err.message.match(/call revert exception/)) { + if ((err as Error).message.match(/call revert exception/)) { logger.info('call revert eth exception', err); } else { logger.error(err); diff --git a/libs/withdraws/src/lib/use-complete-withdraw.ts b/libs/withdraws/src/lib/use-complete-withdraw.ts index 440d5bba2..e1914d76a 100644 --- a/libs/withdraws/src/lib/use-complete-withdraw.ts +++ b/libs/withdraws/src/lib/use-complete-withdraw.ts @@ -56,7 +56,7 @@ export const useCompleteWithdraw = () => { ); } catch (err) { const logger = localLoggerFactory({ application: 'deposits' }); - if (err.message.match(/call revert exception/)) { + if ((err as Error).message.match(/call revert exception/)) { logger.info('call revert eth exception', err); } else { logger.error(err); diff --git a/libs/withdraws/src/lib/use-verify-withdrawal.ts b/libs/withdraws/src/lib/use-verify-withdrawal.ts index a8076d156..c06ef4b53 100644 --- a/libs/withdraws/src/lib/use-verify-withdrawal.ts +++ b/libs/withdraws/src/lib/use-verify-withdrawal.ts @@ -120,7 +120,7 @@ export const useVerifyWithdrawal = () => { return true; } catch (err) { const logger = localLoggerFactory({ application: 'withdraws' }); - if (err.message.match(/call revert exception/)) { + if ((err as Error).message.match(/call revert exception/)) { logger.info('call revert eth exception', err); } else { logger.error(err); diff --git a/libs/withdraws/src/lib/use-withdraw-asset.tsx b/libs/withdraws/src/lib/use-withdraw-asset.tsx index f7c45fb53..d3a7c53d6 100644 --- a/libs/withdraws/src/lib/use-withdraw-asset.tsx +++ b/libs/withdraws/src/lib/use-withdraw-asset.tsx @@ -47,7 +47,7 @@ export const useWithdrawAsset = ( delay = result[1]; } catch (err) { const logger = localLoggerFactory({ application: 'withdraws' }); - if (err.message.match(/call revert exception/)) { + if ((err as Error).message.match(/call revert exception/)) { logger.info('call revert eth exception', err); } else { logger.error(err);