fix: exception handler (#3768)

* fix: user is not sent to sentry

* fix: too much exceptions thrown
This commit is contained in:
Jérémy M
2024-02-02 09:26:48 +01:00
committed by GitHub
parent edeb824884
commit 25f4a80c7c
2 changed files with 10 additions and 1 deletions

View File

@ -49,6 +49,15 @@ export class ExceptionHandlerSentryDriver
scope.setExtra('document', options.document);
}
if (options?.user) {
scope.setUser({
id: options.user.id,
ip_address: options.user.ipAddress,
email: options.user.email,
username: options.user.username,
});
}
for (const exception of exceptions) {
const errorPath = (exception.path ?? [])
.map((v: string | number) => (typeof v === 'number' ? '$index' : v))

View File

@ -90,7 +90,7 @@ export const useExceptionHandler = <
}>(
(acc, err) => {
// Filter out exceptions that we don't want to be captured by exception handler
if (filterException(err)) {
if (filterException(err?.originalError ?? err)) {
acc.filtered.push(err);
} else {
acc.unfiltered.push(err);