diff --git a/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx b/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx index ff34db881a35..6ab1761fda62 100644 --- a/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx +++ b/src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx @@ -115,7 +115,7 @@ function BaseProfilingToolMenu({isProfilingInProgress = false, pathToBeUsed, dis .then(() => { Log.hmmm('[ProfilingToolMenu] file copied successfully'); }) - .catch((error) => { + .catch((error: Record) => { Log.hmmm('[ProfilingToolMenu] error copying file: ', error); }); diff --git a/src/components/SignInButtons/AppleSignIn/index.android.tsx b/src/components/SignInButtons/AppleSignIn/index.android.tsx index a56377940480..ec669590d029 100644 --- a/src/components/SignInButtons/AppleSignIn/index.android.tsx +++ b/src/components/SignInButtons/AppleSignIn/index.android.tsx @@ -37,8 +37,8 @@ function AppleSignIn() { const handleSignIn = () => { appleSignInRequest() .then((token) => Session.beginAppleSignIn(token)) - .catch((error) => { - if (error instanceof Error && error.message === appleAuthAndroid.Error.SIGNIN_CANCELLED) { + .catch((error: Record) => { + if (error.message === appleAuthAndroid.Error.SIGNIN_CANCELLED) { return null; } Log.alert('[Apple Sign In] Apple authentication failed', error); diff --git a/src/libs/Middleware/Logging.ts b/src/libs/Middleware/Logging.ts index 19d767c8a4b1..58031c24722e 100644 --- a/src/libs/Middleware/Logging.ts +++ b/src/libs/Middleware/Logging.ts @@ -1,4 +1,5 @@ import {SIDE_EFFECT_REQUEST_COMMANDS} from '@libs/API/types'; +import type HttpsError from '@libs/Errors/HttpsError'; import Log from '@libs/Log'; import CONST from '@src/CONST'; import type Request from '@src/types/onyx/Request'; @@ -42,7 +43,7 @@ const Logging: Middleware = (response, request) => { logRequestDetails(`Finished API request in ${Date.now() - startTime}ms`, request, data); return data; }) - .catch((error) => { + .catch((error: HttpsError) => { const logParams: Record = { message: error.message, status: error.status, @@ -64,18 +65,20 @@ const Logging: Middleware = (response, request) => { // incorrect url, bad cors headers returned by the server, DNS lookup failure etc. Log.hmmm('[Network] API request error: Failed to fetch', logParams); } else if ( - [ - CONST.ERROR.IOS_NETWORK_CONNECTION_LOST, - CONST.ERROR.NETWORK_REQUEST_FAILED, - CONST.ERROR.IOS_NETWORK_CONNECTION_LOST_RUSSIAN, - CONST.ERROR.IOS_NETWORK_CONNECTION_LOST_SWEDISH, - CONST.ERROR.IOS_NETWORK_CONNECTION_LOST_SPANISH, - ].includes(error.message) + ( + [ + CONST.ERROR.IOS_NETWORK_CONNECTION_LOST, + CONST.ERROR.NETWORK_REQUEST_FAILED, + CONST.ERROR.IOS_NETWORK_CONNECTION_LOST_RUSSIAN, + CONST.ERROR.IOS_NETWORK_CONNECTION_LOST_SWEDISH, + CONST.ERROR.IOS_NETWORK_CONNECTION_LOST_SPANISH, + ] as string[] + ).includes(error.message) ) { // These errors seem to happen for native devices with interrupted connections. Often we will see logs about Pusher disconnecting together with these. // This type of error may also indicate a problem with SSL certs. Log.hmmm('[Network] API request error: Connection interruption likely', logParams); - } else if ([CONST.ERROR.FIREFOX_DOCUMENT_LOAD_ABORTED, CONST.ERROR.SAFARI_DOCUMENT_LOAD_ABORTED].includes(error.message)) { + } else if (([CONST.ERROR.FIREFOX_DOCUMENT_LOAD_ABORTED, CONST.ERROR.SAFARI_DOCUMENT_LOAD_ABORTED] as string[]).includes(error.message)) { // This message can be observed page load is interrupted (closed or navigated away). Log.hmmm('[Network] API request error: User likely navigated away from or closed browser', logParams); } else if (error.message === CONST.ERROR.IOS_LOAD_FAILED) { diff --git a/src/libs/Notification/PushNotification/index.native.ts b/src/libs/Notification/PushNotification/index.native.ts index 426f03c6d408..34699f0610e1 100644 --- a/src/libs/Notification/PushNotification/index.native.ts +++ b/src/libs/Notification/PushNotification/index.native.ts @@ -130,7 +130,7 @@ const register: Register = (notificationID) => { // Refresh notification opt-in status NVP for the new user. refreshNotificationOptInStatus(); }) - .catch((error) => { + .catch((error: Record) => { Log.warn('[PushNotification] Failed to register for push notifications! Reason: ', error); }); }; diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index c022a079df65..b844aa29f670 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -105,11 +105,11 @@ function IOURequestStepScan({ return; } - camera.current.focus(point).catch((ex) => { - if (ex.message === '[unknown/unknown] Cancelled by another startFocusAndMetering()') { + camera.current.focus(point).catch((error: Record) => { + if (error.message === '[unknown/unknown] Cancelled by another startFocusAndMetering()') { return; } - Log.warn('Error focusing camera', ex); + Log.warn('Error focusing camera', error); }); };