Currently, temporal_rs has an error type that contains a kind and a Cow message, alongside an error message enum that's being worked on (probably will do some more refactoring there).
In temporal_capi, and V8, this gets turned in to a kind and a &'static str error. This avoids the extra conditional free FFI call.
This mostly works: 99% of errors are static strings. However, errors arising from ICU4X or ixdtf are not, we call Display on them and store the string.
It would be nice if ixdtf and calendar errors had a way to get a static string message that contains most of the info.
Alternatively, we should consider having the temporal_capi errors be opaque types. I'd like to avoid this, but I suspect the cost we are avoiding is not much.
cc @nekevss @robertbastian @sffc
Currently, temporal_rs has an error type that contains a kind and a Cow message, alongside an error message enum that's being worked on (probably will do some more refactoring there).
In temporal_capi, and V8, this gets turned in to a kind and a
&'static strerror. This avoids the extra conditional free FFI call.This mostly works: 99% of errors are static strings. However, errors arising from ICU4X or ixdtf are not, we call Display on them and store the string.
It would be nice if ixdtf and calendar errors had a way to get a static string message that contains most of the info.
Alternatively, we should consider having the temporal_capi errors be opaque types. I'd like to avoid this, but I suspect the cost we are avoiding is not much.
cc @nekevss @robertbastian @sffc