[web] Promisify ensureAffiliationMiddleware and refactor InstitutionHubsController (#22242 feedback) (#22261)
* Promisify `ensureAffiliationMiddleware` * In `ensureAffiliationMiddleware`, throw when UserNotFoundError * Unnest object `_InstitutionHubsController` * Format fix GitOrigin-RevId: 5b3c6c24724520353540b8d8dd05005b6fa749ff
This commit is contained in:
@@ -202,7 +202,7 @@ async function ensureAffiliationMiddleware(req, res, next) {
|
||||
try {
|
||||
user = await UserGetter.promises.getUser(userId)
|
||||
} catch (error) {
|
||||
return new Errors.UserNotFoundError({ info: { userId } })
|
||||
throw new Errors.UserNotFoundError({ info: { userId } })
|
||||
}
|
||||
// if the user does not have permission to add an affiliation, we skip this middleware
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user