import type { FieldAffectingData } from '../fields/config/types.d.ts'

import APIError from './APIError.js'

class InvalidFieldName extends APIError {
  constructor(field: FieldAffectingData, fieldName: string) {
    super(
      `Field ${field.label} has invalid name '${fieldName}'. Field names can not include periods (.) and must be alphanumeric.`,
    )
  }
}

export default InvalidFieldName
