Closed Manishearth closed 2 years ago
Discussion:
Conclusion:
bool
. @Manishearth or @shadaj to follow up with a design doc later in the summer once we have more of an idea around Diplomat and more cases to inspect.Make a plan for what to do this quarter, and implement in Q1 2022.
Discussion 2022-05-27:
Into
impls into the big giant common error enum.Consensus: Single common error enum, with strings optionally logged using the Rust logger.
LGTM: @QnnOkabayashi @robertbastian @nordzilla @Manishearth @sffc @zbraniecki
So I was getting ready to start implementing this and I realized that in Diplomat, enums become strings in JS, converted after being received as integers. For the JS backend are we okay with that or would we want to return an integer instead?
Ideally Diplomat has support for consts so we can return an integer that you can check against a constant list.
So I was getting ready to start implementing this and I realized that in Diplomat, enums become strings in JS, converted after being received as integers. For the JS backend are we okay with that or would we want to return an integer instead?
Ideally Diplomat has support for consts so we can return an integer that you can check against a constant list.
IMO, I think it's fairly standard for errors to be strings in JS, and this would be my expected behavior. The main thing is that the strings are stable, which for enums they should be.
Hah, that's exactly why I'd prefer not to use strings. Because if we make strings stable we corner ourselves away from ability to improve error messages. I'm ok with string identifiers or numerical error codes plus payload.
yeah these would be string identifiers like "ICU4X_PLURALS_OOPSIE"
(and an enum variant of the same name in C++) which we would stabilize
I'm happy with ICU4X_PLURALS_OOPSIE
. More, I now demand that we add it.
Right now FFI just returns
bool
s for error cases.We should eventually figure out how we want to expose error states over FFI and write error enums for these. The current design is easily extended to error enums.
The hard part here is mostly handling complex error states.