Skip to content

Return errors to Dart #470

Answered by temeddix
poborin asked this question in Q&A
Oct 25, 2024 · 1 comments · 4 replies
Discussion options

You must be logged in to vote
// [RUST-SIGNAL]
// Your implementation of an error.
// It might include a call stack, or an error code etc. 
message ErrorNotify {
    string message = 1; // Human-readable explanation of the error
    int32 error_code = 2;
}

I think this message type is a good idea in general. However I use this error message independently with [RUST-SIGNAL], not by including it inside another message, when I write my app.

Also I recommend you not to write panicking code at all, since Rust have idiomatic Result<T, E>. Also, Rust cannot catch panics on the web platform(wasm32-unknown-unknown), making all callers wait forever.

The function signature of your intent would look like this:

async fn make_http_…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@poborin
Comment options

@temeddix
Comment options

Answer selected by poborin
@temeddix
Comment options

@poborin
Comment options

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