Rust, wasm, panic!() clickable

  1. I am using + Chrome

  2. On panic, we get a number of lines of the form (in the JS Console)

at crate_name::(module_name::)*function_name::some_hash
  1. I want these lines to be click able. Upon clicking on the line, I want the entire string to be sent out of the browser (calling a system program, making an AJAX call, … I don’t care).

  2. I just need to get the string out so I can parse it with an external program and tell IntelliJ to jump to the right file / line.


I have no idea how to do this. I think others also want this. Suggestions?

This is usually achieved with a source map.

It’s sometimes PITA to set up. I see there has been some work done on this:

@kornel : How does the above work? I was under the impression that sourcemaps were NOT supported yet for rust on targedt wasm32-unknown-unknown .

What I am asking is much more light weight (compared to setting up source maps) – the information is already there, I just want a way to make the line of text in JS console clickable.

In particular, what I am requesting can be done entirely as a Chrome plugin, whereas sourcemaps requires deep compiler black magicery.

I haven’t used source maps with WASM, but source maps from other languages give exactly the clickability you want.

Other than that there are no good options for making things clickable in the console. You could log URLs with a custom URL scheme like “web+rust://localhost/” and set up a handler that handles these URLs.

I have used SourceMaps in other languages (CLJS in particular).
I acan not get SourceMaps to work with WASM.

It’s not clear how to get SourceMaps to work with Rustc.

On the other hand, I think there’s a short + simple solution to the problem I have described

To clarify:

  1. I know about SourceMaps.

  2. I do not see a way to setup SourceMaps with target wasm32-unknown-unknown

  3. I want to see if there’s a way we can just hack Chrome console to do this instead.