unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.81k stars 271 forks source link

Put ability term link in payload of unhandled ability exception #5400

Open ceedubs opened 1 month ago

ceedubs commented 1 month ago

Is your feature request related to a problem? Please describe.

Right now if you get a runtime exception due to an unhandled ability it looks like this:

    (IO.Failure.Failure
      (typeLink RuntimeFailure)
      "resolve: unhandled ability request: ReferenceDerived (Id \"b589mbg492brf3k3t0lg706d7ob88jqslgmja9gkrimv4137utuittc2r9l1tgvhrl40f71c99m39ch48gubbjhn5vf2pf5evjsinn8\" 0)"
      (Any ()))

It's not obvious from that error message that this is the Abort ability.

Describe the solution you'd like

I think that instead of Any () the payload should be Any (termLink Abort.abort).

Describe alternatives you've considered

It might also be nice to try to pretty print the ability/constructor name in the failure message (the Text part). However, this isn't reliable, because the runtime might not have a name for the ability/constructor (for example a thunk that has been serialized and sent to another node).