/** Thrown when an API returns validation or business-rule errors for a form. */
export class ApiFormError extends Error {
  readonly fieldErrors?: Record<string, string>

  constructor(message: string, fieldErrors?: Record<string, string>) {
    super(message)
    this.name = "ApiFormError"
    this.fieldErrors = fieldErrors
  }
}
