Comment

Comment by vanderZwan

There was some discussion about this in the Goose discord a few days ago.

One idea that came up was this: you could define a particuda function name as the "landing pad" for handling particular error kinds. Then you "wrap" calls to the library in a function with this name. Here's a part from a larger worked example:

    fn catch_io<F: fn()>() -> IoError {
      F();
      return IoError{ message: "", ok: true }
    }

    let err = catch_io() { c(); };
https://gist.github.com/bkietz/9bf510299ab62bb4c7f7d2db6eff0...

Mind you, this was just discussion, no experience with how well this would work in practice.

parent vanderZwan 6 days ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton