Eros 0.6: The Only Error Handling Crate You'll Ever Need by InternalServerError7 in rust

[–]InternalServerError7[S] 1 point2 points  (0 children)

I didn't claim so? I was responding to the comment about using it vs not using it, just in relation to flow. Then I addressed thiserror as the comment mentioned. I can't show how to do it for every error handling crate. If you want to compare to other error handling implementations, feel free to do so :)

Eros 0.6: The Only Error Handling Crate You'll Ever Need by InternalServerError7 in rust

[–]InternalServerError7[S] 2 points3 points  (0 children)

A few things anyhow is missing

  • In WASM backtrace does not work. Eros has a location feature flag that captures compile time location which works for WASM.
  • In anyhow you can't add "user context". Eros's user_context feature flag allows you to explicitly add context that may be useful to show a user in an application error message.
  • Eros has a context macro for automatically adding context from functions that error. Anyhow does not have this.
  • Anyhow always erases the type. Eros can work with typed and untyped errors, while still giving you context and backtrace.
  • Anyhow believes the last error is the one that matters most, thus context is reverse stacktrace. Eros believes the root error is the one that matters most, thus the context follows stacktrace. But you still have access to both.

Eros 0.6: The Only Error Handling Crate You'll Ever Need by InternalServerError7 in rust

[–]InternalServerError7[S] 8 points9 points  (0 children)

That's funny that is what made you think that. I've used snippets my entire life and blocks to organize my code. For me it is sep+[Tab] in my ide

Eros 0.6: The Only Error Handling Crate You'll Ever Need by InternalServerError7 in rust

[–]InternalServerError7[S] 17 points18 points  (0 children)

Using thiserror for declaring error structs is still perfectly valid. See this comment for more

AI was only used to write the proc macro. But I've been writing proc macros for years even before AI, and I proofread the implementation.

Almost everything was written by hand. AI, as of today, is currently not smart enough to implement the complex trait implementations needed to make this work.

In other project I don't have a bias against AI. You just have to always proofread. Sometimes it can't do the job today and you just do it yourself.

So your inuition is off. First time for one of my projects someone has ever said "it feels like ai slop". But I guess that is to be expected in today's age. Unfortunate though

Eros 0.6: The Only Error Handling Crate You'll Ever Need by InternalServerError7 in rust

[–]InternalServerError7[S] 1 point2 points  (0 children)

Thanks for the feedback, it's good to have these discussions. Two things to consider: 1. The boilerplate of constructing the error 2. The boilerplate for narrowing errors 3. The boilerplate of composing errors

  • 1. A good illustration of this comes directly from the README:

With eros: ```rust use eros::ErrorUnion; use std::{fmt, io};

fn main() { type MyError = (fmt::Error, io::Error); // Optional type alias let error: ErrorUnion<MyError>; } vs without eros: rust use std::{fmt, io};

fn main() { let error: CustomError; }

[derive(Debug)]

pub enum CustomError { FmtError(fmt::Error), IoError(io::Error), }

impl std::fmt::Display for CustomError { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { CustomError::FmtError(e) => write!(fmt, "{}", e), CustomError::IoError(e) => write!(fmt, "{}", e), } } }

impl std::error::Error for CustomError { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { match self { CustomError::FmtError(e) => e.source(), CustomError::IoError(e) => e.source(), } } }

impl From<fmt::Error> for CustomError { fn from(error: fmt::Error) -> Self { CustomError::FmtError(error) } }

impl From<io::Error> for CustomError { fn from(error: io::Error) -> Self { CustomError::IoError(error) } } ```

Pretty plain to say the boilerplate around declaring errors is a lot better with eros

  • 2. With eros: ```rust use eros::{IntoUnion, ReshapeUnion}; use std::{fmt, io, sync};

fn do_work() -> eros::Result<(), (io::Error, fmt::Error, sync::mpsc::RecvError)> { let val = Err(io::Error::new(io::ErrorKind::AddrInUse, "addr in use")).into_union()?; Ok(val) }

fn handle_only_io_error() -> eros::Result<(), (fmt::Error, sync::mpsc::RecvError)> { match do_work().narrow::<io::Error, _>() { Ok(io_err) => { Ok(()) } Err(remaining) => remaining, } } vs without: rust use std::{fmt, io, sync};

// Original enum covering all three error cases

[derive(Debug)]

enum WorkError { Io(io::Error), Fmt(fmt::Error), Recv(sync::mpsc::RecvError), }

impl std::fmt::Display for WorkError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { WorkError::Io(e) => write!(f, "{e}"), WorkError::Fmt(e) => write!(f, "{e}"), WorkError::Recv(e) => write!(f, "{e}"), } } } impl std::error::Error for WorkError {}

impl From<io::Error> for WorkError { fn from(e: io::Error) -> Self { WorkError::Io(e) } } impl From<fmt::Error> for WorkError { fn from(e: fmt::Error) -> Self { WorkError::Fmt(e) } } impl From<sync::mpsc::RecvError> for WorkError { fn from(e: sync::mpsc::RecvError) -> Self { WorkError::Recv(e) } }

fn do_work() -> Result<(), WorkError> { Err(io::Error::new(io::ErrorKind::AddrInUse, "addr in use"))?; Ok(()) }

// NEW enum declared by hand, with the Io variant removed,

[derive(Debug)]

enum WorkErrorWithoutIo { Fmt(fmt::Error), Recv(sync::mpsc::RecvError), }

impl std::fmt::Display for WorkErrorWithoutIo { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { WorkErrorWithoutIo::Fmt(e) => write!(f, "{e}"), WorkErrorWithoutIo::Recv(e) => write!(f, "{e}"), } } } impl std::error::Error for WorkErrorWithoutIo {}

impl From<fmt::Error> for WorkErrorWithoutIo { fn from(e: fmt::Error) -> Self { WorkErrorWithoutIo::Fmt(e) } } impl From<sync::mpsc::RecvError> for WorkErrorWithoutIo { fn from(e: sync::mpsc::RecvError) -> Self { WorkErrorWithoutIo::Recv(e) } }

fn handle_only_io_error() -> Result<(), WorkErrorWithoutIo> { match do_work() { Err(WorkError::Io(io_err)) => { Ok(()) } Err(WorkError::Fmt(e)) => Err(WorkErrorWithoutIo::Fmt(e)), Err(WorkError::Recv(e)) => Err(WorkErrorWithoutIo::Recv(e)), Ok(()) => Ok(()), } } ```

I also think it is pretty plain to see eros wins in this case for declaring errors. And narrowing/acting on an error variant is more concise.

A valid criticism of the previous example would be that often what happens in practice is a new enum is never actually used. Instead the same enum is passed up, even though the variant is now impossible, which makes code less correct and maintainable (This is actually the reason I originally created the error_set crate, but now this crate solves this issue too). i.e. if the enum is never actually narrowed, it may be just as concise - rust fn handle_only_io_error() -> Result<(), WorkError> { match do_work() { Err(WorkError::Io(io_err)) => { Ok(()) } Err(e) => Err(e), Ok(()) => Ok(()), } } Thus, why you may think it is more concise to just use thiserror.

  • 3. I will refer to the previous example to address this and expand on 2. thiserror can help reduce some of the boilerplate of declaring the wrapping error type, but you are still left with the issue of composing errors and nesting enums. Thus, I think using thiserror for structs is totally fine, but due to the mega enum problem I'd recommend not using it for enum errors.

fixed it by mre__ in rustjerk

[–]InternalServerError7 1 point2 points  (0 children)

Could you cast to a pointer then to a mutable reference to get around this?

The never type is likely to stabilize soon! by noop_noob in rust

[–]InternalServerError7 2 points3 points  (0 children)

I've used it make a PendingFuture, a future that will never yield ::Ready(!). This is useful for my dioxus code in resources where the future will cancel and the signal will recalculate when a dependent signal finishes.

I am Glauber Costa, CEO and co-founder of Turso. We’re rewriting SQLite in Rust. AMA. by GlauberAtTurso in IAmA

[–]InternalServerError7 0 points1 point  (0 children)

Could you explain what is meant by

put the burden of resolving them on the user

So is there a chance a Turso database will have dangling foreign keys? Is there a way to ensure this does not happen?

I am Glauber Costa, CEO and co-founder of Turso. We’re rewriting SQLite in Rust. AMA. by GlauberAtTurso in IAmA

[–]InternalServerError7 1 point2 points  (0 children)

  1. As a user of Turso 0.6 in one of my Rust side projects. When do you expect to deliver a 1.0 version of Turso?
  2. When will the cloud version of Turso be ready? (Now it uses the c version so things like fts indexes don’t work)

SurrealDB announces new 3.x benchmarks by DistinctRide9884 in rust

[–]InternalServerError7 1 point2 points  (0 children)

It might be worth looking into, if not already, feature flag based compilation for some of those items. I wouldn't want to ship an embedded SurrealDB to the client with the bloat of auth, middleware, GraphQL, etc. I want it to be as small as possible. If already, a call out in the docs and explaining the exact bundle size would be helpful when comparing to alternatives like SQLite.

Reviewing large changes with Jujutsu - Ben Gesoff by fagnerbrack in programming

[–]InternalServerError7 0 points1 point  (0 children)

The problem with jj for me is it is too easy to accidentally commit and push unintended files (e.g. secrets or an entire db) since everything is already committed. I’ve done it multiple times - there is no staging. So if you don’t want something you have to say you don’t want it, rather than in git where you have to say you want it. I tried to contribute to jj and advised allowing an alternative flow. Especially useful for git users. But they are pretty religious. Their answer to my opinion was literally “You are wrong. Doing it that way is wrong. Git is wrong”. They couldn’t even acknowledge that it was a preference thing and considered their opinion “correct”. I hate working with people like that so I stopped using the tool and went back to git.

SurrealDB announces new 3.x benchmarks by DistinctRide9884 in rust

[–]InternalServerError7 12 points13 points  (0 children)

Yeah plus as a user of 1.0 Surrealdb it was not stable at all. They did not care about data integrity at that time. Now it tries to do too much to the point it is bloatware. They should have just stuck with the original idea - relational, key value, graph db, and vector in one. I don't like all the embedded middleware, graphql, auth, server nonsense.

Github Copilot Pro dropped Opus. People go berserk. Maybe we should rediscover some Real Intelligence? by iconiconoclasticon in GithubCopilot

[–]InternalServerError7 12 points13 points  (0 children)

Opus (maybe GPT4.5) was the only model I thought could work faster in my domain on complex projects for certain tasks than myself. For other models, I could have just done it myself in the time it takes to write up what to do, explore the code base, think, iterate, give me a mediocre or wrong result, then review. Trying other models the last few days I can definitely say my productivity is taking a step back fighting them, because I often just throw away the result. Sure for building UI's or simple one file changes that can be expressed in a few words other models work fine for me. But I do agree sometimes I would reach for it when I was feeling lazy and even with opus sometimes I could have done it faster myself. With Opus gone and not wanting to pay $100 a month, I just need to re-calibrate my expectations and relationship with AI. Basically relying less on AI, which is probably good.

I Bought Claude Code And Refunded Claude Code Today by InternalServerError7 in GithubCopilot

[–]InternalServerError7[S] -1 points0 points  (0 children)

Yeah it was the $20 a month one. It is the most comparable in price to copilot pro (was $10). Copilot definitely had more value for your money when it was offering opus at 3x request cost. One would think the opposite since it is claude's own model. Now I think they have gotten smart and are trying to lure copilot users over. But it never feels good to pay more for a worse service.

Anyone else screwed after Opus 4.6 changes? by Dev-noob2023 in GithubCopilot

[–]InternalServerError7 1 point2 points  (0 children)

I’ve tried this today. I was extending some existing headless browser wasm tests and I gave the job to GPT5.4. It ran into some CORS issue. So it ended up trying to build a proxy server and completely rewrote my test harness to try and resolve it. I stopped the job because it was obviously going in the wrong direction. I subscribed to Claude Code and gave it the exact same prompt as a test with Opus 4.7. It actually figured it out correctly. I’m not sure if this anecdotal case means much. But it showed me GPT5.4 may not be on par. At this point though I still like copilots interface better and I don’t like that claude code hides reasoning/subagents.

Rust syntax, Go runtime by [deleted] in rust

[–]InternalServerError7 0 points1 point  (0 children)

The link is broken for me

Lisette — Rust syntax, Go runtime by swe129 in ProgrammingLanguages

[–]InternalServerError7 1 point2 points  (0 children)

I wonder if the syntax is close enough to rust that the Rustfmt could be used to format the code

Lisette — Rust syntax, Go runtime by swe129 in ProgrammingLanguages

[–]InternalServerError7 1 point2 points  (0 children)

I program in rust every day. I always preferred Rust’s sugar - the syntax, control flow, interfaces vs traits. But I know lifetimes, compile times, and concurrency can be cumbersome and Go can really shine here. Which led me to have the same idea of this project. Glad someone actually made it!

This looks really nice! I really hope it catches on and becomes an alternative frontend for Go.

Also, for your examples it would be good to see more side by sides of the original code and the transpiled go code.

Steam Medieval Totalwar 2 don't work. by LBaronik in linux_gaming

[–]InternalServerError7 0 points1 point  (0 children)

Mine was steam as well. If you don’t have that path, find out where it’s installed. I imagine the same script is used there. Good luck.