Skip to content

EZ Web Audio / ValidationError

Class: ValidationError

Defined in: packages/core/src/errors/validation-error.ts:27

Error thrown when caller-supplied input fails validation, or an API is used in a way it does not support (calling a method after dispose(), mutating a synced BeatTrack directly, an out-of-range parameter, etc).

This is the "you called this wrong" error class — as opposed to AudioLoadError (fetch/decode failures) or AudioContextError (AudioContext state issues). Every parameter-range and misuse check across the library (gain, pan, BPM, frequency, control-type names, disposed instances, etc.) throws ValidationError.

Example

typescript
import { ValidationError } from 'ez-web-audio'

try {
  sound.changeGainTo(-1)
} catch (e) {
  if (e instanceof ValidationError) {
    console.error(`Invalid input: ${e.message}`)
  }
}

Extends

Constructors

Constructor

new ValidationError(message): ValidationError

Defined in: packages/core/src/errors/validation-error.ts:33

Create a new ValidationError.

Parameters

message

string

Human-readable error description with actionable fix

Returns

ValidationError

Overrides

AudioError.constructor

Properties

code?

readonly optional code: string

Defined in: packages/core/src/errors/audio-error.ts:34

Optional error code for programmatic handling

Inherited from

AudioError.code