ez-web-audio
Version:
Making the Web Audio API super EZ since 2024.
31 lines • 887 B
TypeScript
/**
* Base error class for all audio-related errors.
*
* Provides a consistent error structure with optional error codes
* for programmatic error handling. Subclasses add specific context
* like URL, note identifier, or AudioContext state.
*
* @example
* ```typescript
* import { AudioError } from 'ez-web-audio'
*
* try {
* await sound.play()
* } catch (e) {
* if (e instanceof AudioError) {
* console.error(`Audio error [${e.code}]: ${e.message}`)
* }
* }
* ```
*/
export declare class AudioError extends Error {
readonly code?: string | undefined;
/**
* Create a new AudioError.
*
* @param message - Human-readable error description with actionable fix
* @param code - Optional error code for programmatic handling
*/
constructor(message: string, code?: string | undefined);
}
//# sourceMappingURL=audio-error.d.ts.map