Skip to content

Commit ecf3654

Browse files
committed
fix: trombi don't crash when error in format orga
1 parent 0d598fb commit ecf3654

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/operations/user.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,16 @@ export const fetchOrgas = async (): Promise<Orga[]> => {
258258
},
259259
},
260260
});
261-
return orgas.map((orga) => {
262-
// log the orga to see what it looks like
263-
logger.debug(`Format de l'orga : ${orga.username}`);
264-
logger.debug(orga);
265-
logger.debug(orga.id);
266-
logger.debug(orga.orga);
267-
const formattedOrga = formatOrga(orga);
268-
return formattedOrga;
269-
});
261+
return orgas
262+
.map((orga) => {
263+
try {
264+
return formatOrga(orga);
265+
} catch (error) {
266+
logger.error(`Error while formatting orga ${orga.id}`, error);
267+
return null;
268+
}
269+
})
270+
.filter((orga) => orga !== null);
270271
};
271272

272273
export const createUser = async (user: {

0 commit comments

Comments
 (0)