"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateZodExceptionFilter = generateZodExceptionFilter;
function generateZodExceptionFilter() {
    return `import { ArgumentsHost, Catch, HttpException, Logger } from '@nestjs/common'
import { BaseExceptionFilter } from '@nestjs/core'

import { ZodSerializationException } from 'nestjs-zod'
import { ZodError } from 'zod'

@Catch(HttpException)
export class ZodExceptionFilter extends BaseExceptionFilter {
  private readonly logger = new Logger(ZodExceptionFilter.name)

  override catch(exception: HttpException, host: ArgumentsHost) {
    if (exception instanceof ZodSerializationException) {
      const zodError = exception.getZodError()
      if (zodError instanceof ZodError) {
        this.logger.error('ZodSerializationException: ' + zodError.message)
      }
    }

    super.catch(exception, host)
  }
}
`;
}
//# sourceMappingURL=zod-exception-filter.generator.js.map