#Using Command Result in rust front ends.

6 messages · Page 1 of 1 (latest)

vast flare
#

Hey everyone, I’m getting started with Tauri using Leptos as a front end. I’ve got the app up and running and am currently trying to figure out how I would use the from_value function to get the result from the backend.

I’ve followed the directions so far and my custom error is deriving thiserror::Error and my command returns a result where the error type is my custom error. So far so good.

Out in the Leptos app, I’m able to invoke the command and when the result is ok, I get my return type and all is well, however, when it is an error variant I get a wasm_bindgen error instead of a string like I would have expected and I’m not sure what to do with that. In the console it causes a panic. I can provide code if necessary, but was wondering if someone has an example of handling result types in a rust front end that I could use for reference.

vast flare
#

I’ve also tried not deriving an error type and just sending back the error enum which derives serialize and deserialize traits. This produces an unexpected exception as well. Not sure else what to do but it feels like I may have to give up if I can’t get this simple of a problem working.

plush frost
plush frost
#

Also whenever you post here we ask people to provide cargo tauri info and their relevant error messages copy pasted, as Idk what kind of error or panic happens and just guess here 😅

vast flare
#

#general message