Skip to content

Event handler for all errors in AudioWorkletProcessor #2548

@mehagar

Description

@mehagar

The current specification includes onprocessorerror (https://www.w3.org/TR/webaudio/#dom-audioworkletnode-onprocessorerror), but I would like to be able to get events from errors that may happen in other contexts.

For example, I have this:

class CustomAudioWorletProcessor extends AudioWorkletProcessor {
  constructor(options) {
    super();
    this.port.onmessage = ((message) => throw new Error('test exception'));
  }
}

onprocessorerror will not receive the test exception, because the error does not occur in the constructor. It is only later when I send a message to the worklet processor that the exception happens.

Is it possible to do this already? Ideally I would be able to register an event handler like so:

myAudioNode.onerror = (event) => { console.log('error in worklet') }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions