import { DbErrorCodes } from './enums' ; import { IErrorObject } from './interfaces' ; param { string } errorCode return { * } export const validateDbError = ( errorCode ) : IErrorObject => { switch ( errorCode ) { case DbErrorCodes . UniqueViolation : return { code : 409 , message : 'Duplicated entry' } ; default : return { code : 400 , message : 'Bad Request' } ; } } ;