Skip to content

Commit

Permalink
finish typing
Browse files Browse the repository at this point in the history
  • Loading branch information
war-in committed May 21, 2024
1 parent 9ef0e19 commit f926b0d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/components/ProfilingToolMenu/BaseProfilingToolMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function BaseProfilingToolMenu({isProfilingInProgress = false, pathToBeUsed, dis
.then(() => {
Log.hmmm('[ProfilingToolMenu] file copied successfully');
})
.catch((error) => {
.catch((error: Record<string, unknown>) => {
Log.hmmm('[ProfilingToolMenu] error copying file: ', error);
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/SignInButtons/AppleSignIn/index.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown>) => {
if (error.message === appleAuthAndroid.Error.SIGNIN_CANCELLED) {
return null;
}
Log.alert('[Apple Sign In] Apple authentication failed', error);
Expand Down
21 changes: 12 additions & 9 deletions src/libs/Middleware/Logging.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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<string, unknown> = {
message: error.message,
status: error.status,
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Notification/PushNotification/index.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const register: Register = (notificationID) => {
// Refresh notification opt-in status NVP for the new user.
refreshNotificationOptInStatus();
})
.catch((error) => {
.catch((error: Record<string, unknown>) => {
Log.warn('[PushNotification] Failed to register for push notifications! Reason: ', error);
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown>) => {
if (error.message === '[unknown/unknown] Cancelled by another startFocusAndMetering()') {
return;
}
Log.warn('Error focusing camera', ex);
Log.warn('Error focusing camera', error);
});
};

Expand Down

0 comments on commit f926b0d

Please sign in to comment.