Skip to content

Commit c41b1fa

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

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,21 @@ 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+
await session.abortTransaction()
49+
// Handle the specific error thrown by BaseOrgRepository.createOrg
50+
if (error.message && error.message.includes('Unknown Org type requested')) {
51+
return res.status(400).json({ message: error.message })
52+
}
53+
return res.status(500).json({ message: error })
4754
} finally {
4855
await session.endSession()
4956
}
5057

5158
logger.info({ uuid: req.ctx.uuid, message: 'The orgs were sent to the user.' })
5259
return res.status(200).json(returnValue)
5360
} catch (err) {
54-
next(err)
61+
return res.status(500).json({ message: err })
5562
}
5663
}
5764

0 commit comments

Comments
 (0)