Skip to content

Commit fc14418

Browse files
committed
TEMP: Pushing triage code to dev
1 parent d7eee83 commit fc14418

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/controller/registry-org.controller/registry-org.controller.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,20 @@ async function getAllOrgs (req, res, next) {
4444
const conversation = await conversationRepo.getAllByTargetUUID(returnValue.organizations[i].UUID, isSecretariat, { session })
4545
returnValue.organizations[i].conversation = conversation?.length ? conversation : undefined
4646
}
47+
} catch (error) {
48+
// Handle the specific error thrown by BaseOrgRepository.createOrg
49+
if (error.message && error.message.includes('Unknown Org type requested')) {
50+
return res.status(400).json({ message: error.message })
51+
}
52+
return res.status(500).json({ catch: 'inner', message: error })
4753
} finally {
4854
await session.endSession()
4955
}
5056

5157
logger.info({ uuid: req.ctx.uuid, message: 'The orgs were sent to the user.' })
5258
return res.status(200).json(returnValue)
5359
} catch (err) {
54-
next(err)
60+
return res.status(500).json({ catch: 'outer', message: err })
5561
}
5662
}
5763

0 commit comments

Comments
 (0)