You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, there are inconsistent patterns for error handling in role-permissions.util.js. The new getDefaultGroupRole function uses throw new HttpError while other functions use next(new HttpError).
Proposed Change
Standardize error handling across all functions to use throw new HttpError pattern:
} catch (error) {
logger.error(`🐛🐛 Internal Server Error ${error.message}`);
- next(- new HttpError(- "Internal Server Error",- httpStatus.INTERNAL_SERVER_ERROR,- { message: error.message }- )- );+ throw new HttpError(+ "Internal Server Error",+ httpStatus.INTERNAL_SERVER_ERROR,+ { message: error.message }+ );
}
Benefits
Consistent error handling pattern throughout the file
Cleaner error propagation
Better alignment with JavaScript's error handling mechanisms
Background
Currently, there are inconsistent patterns for error handling in
role-permissions.util.js
. The newgetDefaultGroupRole
function usesthrow new HttpError
while other functions usenext(new HttpError)
.Proposed Change
Standardize error handling across all functions to use
throw new HttpError
pattern:Benefits
References
The text was updated successfully, but these errors were encountered: