<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>afdbcreid</author><text>I don&amp;#x27;t like having to wrap my function with a macro, with all disadvantages (e.g. worse IDE support), just to get error location. Especially given we can do this without macros at all:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    use std::error::Error as StdError;
    use std::panic::Location;
    use std::fmt;

    #[derive(Debug)]
    pub struct MyError {
        pub error: Box&amp;lt;dyn StdError + Send + Sync&amp;gt;,
        pub location: &amp;amp;&amp;#x27;static Location&amp;lt;&amp;#x27;static&amp;gt;,
    }
    
    impl&amp;lt;E: StdError + Send + Sync + &amp;#x27;static&amp;gt; From&amp;lt;E&amp;gt; for MyError {
        #[track_caller]
        #[inline]
        fn from(error: E) -&amp;gt; Self {
            Self {
                error: Box::new(error),
                location: Location::caller(),
            }
        }
    }
    
    impl fmt::Display for MyError {
        fn fmt(&amp;amp;self, f: &amp;amp;mut fmt::Formatter&amp;lt;&amp;#x27;_&amp;gt;) -&amp;gt; fmt::Result {
            write!(f, &amp;quot;{}, {}&amp;quot;, self.error, self.location)
        }
    }
&lt;/code&gt;&lt;/pre&gt;
We can also optimize this more (e.g. a simple optimization to be two words instead of three: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;play.rust-lang.org&amp;#x2F;?version=stable&amp;amp;mode=debug&amp;amp;edition=2021&amp;amp;gist=2a46e8a71103b4a2f432defc320dc06a&quot; rel=&quot;nofollow noreferrer&quot;&gt;https:&amp;#x2F;&amp;#x2F;play.rust-lang.org&amp;#x2F;?version=stable&amp;amp;mode=debug&amp;amp;editio...&lt;/a&gt;. Also allows opting `Send` and `Sync` out or using non-`&amp;#x27;static` lifetimes), but this works as a baseline. The only disadvantage is that if called in a function with `#[track_caller]` this will report the location of the caller... But this is something I can live with.</text><parent_chain></parent_chain></comment><story><title>Enhance Rust errors with file and line details</title><url>https://crates.io/crates/wherr</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>diarrhea</author><text>Reminds me of `diags` from [0].&lt;p&gt;Side note: can we make &amp;#x27;file not found&amp;#x27; errors that fail to mention &lt;i&gt;what&lt;/i&gt; wasn&amp;#x27;t found illegal? What&amp;#x27;s the point of &amp;#x27;file not found&amp;#x27;, then keeping silent about the exact file? Seen it in various ecosystems now.&lt;p&gt;[0]: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.lurklurk.org&amp;#x2F;effective-rust&amp;#x2F;macros.html#when-to-use-macros&quot; rel=&quot;nofollow noreferrer&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.lurklurk.org&amp;#x2F;effective-rust&amp;#x2F;macros.html#when-to-...&lt;/a&gt;</text><parent_chain></parent_chain></comment><story><title>Enhance Rust errors with file and line details</title><url>https://crates.io/crates/wherr</url></story>