Skip to content

EZ Web Audio / InvalidNoteError

Class: InvalidNoteError ​

Defined in: packages/core/src/errors/invalid-note-error.ts:26

Error thrown when a note identifier is invalid.

Note identifiers follow the format: Letter + optional accidental + octave

  • Letters: A-G (case insensitive)
  • Accidentals: # (sharp), b (flat), or none (natural)
  • Octave: 0-8

Valid examples: A4, Bb3, C#5, D2, Eb6 Invalid examples: H4, A9, B##3, 4A

Example ​

typescript
function parseNote(identifier: string) {
  if (!isValidNote(identifier)) {
    throw new InvalidNoteError(
      `Invalid note: "${identifier}". Expected format: Letter + optional accidental + octave (e.g., A4, Bb3, C#5).`,
      identifier
    );
  }
}

Extends ​

Constructors ​

Constructor ​

new InvalidNoteError(message, identifier): InvalidNoteError

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

Create a new InvalidNoteError.

Parameters ​

message ​

string

Human-readable error description with actionable fix

identifier ​

string

The invalid note identifier that was provided

Returns ​

InvalidNoteError

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


identifier ​

readonly identifier: string

Defined in: packages/core/src/errors/invalid-note-error.ts:35

The invalid note identifier that was provided