Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Added logging for location duplicate error
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzlamateen committed Oct 31, 2023
1 parent 95cea61 commit ed9a01d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/server-core/src/social/location/location.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const getUpdateResult = async (context: HookContext<LocationService>) => {

const duplicateNameError = async (context: HookContext<LocationService>) => {
if (context.error) {
logger.error(context.error, `duplicateNameError in ${context.path} service`, context.data, context.params)
if (context.error.code === 'ER_DUP_ENTRY') {
throw new BadRequest('Name is in use.')
} else if (context.error.errors && context.error.errors[0].message === 'slugifiedName must be unique') {
Expand Down

0 comments on commit ed9a01d

Please sign in to comment.