Figma Support Forum

Catching & reporting a traceback within Plugin

I’m looking for a way to instrument tracebacks within the plugin (on the scene or UI part) with something similar to Sentry. And while in principle it is possible to attach Sentry, the traceback itself seems to be wrapped into “data:” URLs, making it impossible for any instrumentation to navigate the source of the traceback.

What’s the correct way to instrument tracebacks? Is there a way to get the “original” file name so that it is possible to use source maps, etc.?

I’m using typescript + webpack, but in fact, this does not matter much, consider this example:

In this example, it is a development webpack-ed build, with traceback being available for Figma, but Sentry won’t catch it, since “at” roots at “data: text/html…”.

The sample applies to the “production” build, which gets minified and the original references to “.ts” files get lost.

Example Sentry instrumentation is:

import * as Sentry from "@sentry/browser"
import { Integrations } from "@sentry/tracing"
...
  Sentry.init({
    dsn: "...",
    integrations: [new Integrations.BrowserTracing()],
    tracesSampleRate: 1.0,
  })

So the question is: regardless Sentry is used or not, is it possible to retrieve original file name & location in the tracebacks, instead of embedded “data: …” locations?