Enable use unknown in catch variables (#2784)
* Enable use unknown in catch variables rule * Add type guards in useAuthProvider * Add type cast in FilterErrorsList * Handle error in tasks
This commit is contained in:
parent
443a94834e
commit
b0ba5cc2ab
4 changed files with 17 additions and 4 deletions
|
@ -157,7 +157,11 @@ export function useAuthProvider({
|
|||
|
||||
return result.data.tokenCreate;
|
||||
} catch (error) {
|
||||
if (error instanceof ApolloError) {
|
||||
handleLoginError(error);
|
||||
} else {
|
||||
setErrors(["unknownLoginError"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -195,7 +199,11 @@ export function useAuthProvider({
|
|||
|
||||
return result?.data?.externalObtainAccessTokens;
|
||||
} catch (error) {
|
||||
if (error instanceof ApolloError) {
|
||||
handleLoginError(error);
|
||||
} else {
|
||||
setErrors(["unknownLoginError"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ const FilterErrorsList: React.FC<FilterErrorsListProps> = ({
|
|||
{ dependencies: dependencies?.join() },
|
||||
);
|
||||
} catch (e) {
|
||||
errorTracker.captureException(e);
|
||||
errorTracker.captureException(e as Error);
|
||||
console.warn("Translation missing for filter error code: ", code);
|
||||
return intl.formatMessage(validationMessages.UNKNOWN_ERROR);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,11 @@ export async function handleTask(task: QueuedTask): Promise<TaskStatus> {
|
|||
});
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
task.onError(error);
|
||||
} else {
|
||||
console.error("Unknown error", error);
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"strictBindCallApply": true,
|
||||
"useUnknownInCatchVariables": true,
|
||||
"paths": {
|
||||
"@assets/*": ["assets/*"],
|
||||
"@locale/*": ["locale/*"],
|
||||
|
|
Loading…
Reference in a new issue