chaokunyang commented on code in PR #2765:
URL: https://github.com/apache/fory/pull/2765#discussion_r2428632659
##########
rust/fory-core/src/error.rs:
##########
@@ -15,38 +15,102 @@
// specific language governing permissions and limitations
// under the License.
+use std::borrow::Cow;
+
use thiserror::Error;
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum Error {
- #[error("Fory on Rust not support Ref type")]
- Ref,
+ // not use this, just as a example.
+ // You can create new error enums for specific cases in the future.
+ #[error("Type mismatch: type_a = {0}, type_b = {1}")]
+ TypeMismatch(u32, u32),
+ // don't use this directly, use Error::from() instead
#[error(transparent)]
- Other(#[from] anyhow::Error),
+ Wrapped(#[from] anyhow::Error),
+
+ /// A simple error message, stored as a [`Cow<'static, str>`].
+ ///
+ /// Do not construct this variant directly; use [`Error::msg`] instead.
+ #[error("{0}")]
+ Msg(Cow<'static, str>),
Review Comment:
How about name it to `Unknown`. All known error in fory should have special
error type
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]