EZ Web Audio / InvalidNoteError
Class: InvalidNoteError
Defined in: 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: 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
Properties
code?
readonlyoptionalcode:string
Defined in: errors/audio-error.ts:30
Optional error code for programmatic handling
Inherited from
identifier
readonlyidentifier:string
Defined in: errors/invalid-note-error.ts:35
The invalid note identifier that was provided