Skip to content

Commit

Permalink
fix: do not log siren format error
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierJp committed Sep 27, 2024
1 parent 53e2a05 commit 5fceb70
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions models/core/unite-legale.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { clientUniteLegaleIG } from '#clients/api-proxy/greffe';
import {
HttpBadRequestError,
HttpForbiddenError,
HttpNotFound,
HttpServerError,
Expand Down Expand Up @@ -355,15 +356,16 @@ const fetchUniteLegaleFromIG = async (
try {
return await clientUniteLegaleIG(siren);
} catch (e: any) {
if (e instanceof HttpNotFound) {
// not found or not a valid siren
if (e instanceof HttpNotFound || e instanceof HttpBadRequestError) {
return APINotRespondingFactory(EAdministration.INFOGREFFE, 404);
}

logWarningInSentry(
new FetchRessourceException({
ressource: 'UniteLegaleGreffe',
administration: EAdministration.INFOGREFFE,
message: `Fail to fetch from InfoGreffe API`,
message: `Fail to fetch from IG API`,
cause: e,
context: {
siren,
Expand Down

0 comments on commit 5fceb70

Please sign in to comment.