1fceda4724
* chore(refactor): tests use vitest and msw * fix(directory): Ensure filenames conform to eslint requirements * chore(yarn): Specify node engine version * fix(yarn): use the proper nodelinker * fix(GitHub workflow): yarn install with caching * docs(README): update to match changes --------- Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
13 lines
356 B
TypeScript
13 lines
356 B
TypeScript
import { Logger } from '../logging/logger.js'
|
|
import { fromZodError } from 'zod-validation-error'
|
|
import { ZodError } from 'zod'
|
|
|
|
export function handleZodError(err: unknown, logger: Logger): void {
|
|
if (err instanceof ZodError) {
|
|
const validationError = fromZodError(err)
|
|
logger.error(validationError)
|
|
throw validationError
|
|
}
|
|
throw err
|
|
}
|