Extensions error handling

Related to: Error handling

Has anything changed in how ui extensions emit error events? I’m currently revisiting my setup and found that unhandledrejection event doesn’t fire at all. And error event all it has is just “Script error.” :thinking:

I added this to my extension:

self.addEventListener("unhandledrejection", (event) => {
  console.log("This is unhandled rejection", event)
})

self.addEventListener("error", (event) => {
  console.log("This is error", event)
})

And triggered errors with following:

    <>
      <Button
        onPress={() => {
          setTimeout(() => {
            throw new Error("This is a test error in the worker")
          }, 1000)
        }}
      >
        This will throw an error
      </Button>
      <Button
        onPress={() => {
          setTimeout(() => {
            Promise.reject("This is a test unhandled rejection in the worker")
          }, 2000)
        }}
      >
        This will throw an unhandled rejection
      </Button>
    </>

And this is what I get: