Skip to content

Pure Source Error with Location #433

Discussion options

You must be logged in to vote

I can't immediately think of a great way to do this with SNAFU.


I'm not sure I completely understand what it is you want to do, but extrapolating from "adding error Location details to source errors", it sounds like you want to make it easier for the programmer. If that's the case, it seems like you'd want something syntactically like

std::env::var("MISSING_VARIABLE").add_location()?;
std::io::read('/foo').add_location()?;
foo.try_into().add_location()?;

However, I'd highly discourage such a path because the error message is basically useless to the person running the program:

Error: environment variable not found (src/main.rs:100:100)

One of the biggest points of SNAFU is that you add …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cloud303-cholden
Comment options

Answer selected by cloud303-cholden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants