dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Implement Into<CaptureError> for the default server function error type

Open ealmloff opened this issue 9 months ago • 2 comments

Now that the server function crate has support for custom error types, we can use a type that is easier to convert into the dioxus error type. This PR switches to our own implementation of a server error type which can be converted into the dioxus captured error type with ?.

Why can't we use the CapturedError type directly?

The CapturedError type is a boxed Error without the Send requirement. We need the error type to implement Send for our axum integration. Serializing the CapturedError type also has some odd interactions. If you serialize the type and then try to downcast it, the downcast will fail because the serialization and deserialization looses the type information

This and the new server function custom error type support close https://github.com/DioxusLabs/dioxus/issues/3243. We now use json serialization for the default error type or you can use a custom error type for more control

ealmloff avatar May 26 '25 18:05 ealmloff

Will this affect https://github.com/DioxusLabs/dioxus/issues/3832?

Andrew15-5 avatar May 31 '25 23:05 Andrew15-5

Will this affect #3832?

No, this is still a server-only datatype. That issue should already be fixed in 0.7 with the new server fn release. You can now return any error that implements FromServerFnError

ealmloff avatar Jun 02 '25 13:06 ealmloff