10 ms·
Yeah,that's a good point. Certainly Rust or anyone else could implement a simple function that returns a populated error struct with the given string message.
by NateDad 12y ago
Yeah,that's a good point. Certainly Rust or anyone else could implement a simple function that returns a populated error struct with the given string message.
I guess my initial reaction of a lot of boilerplate was mainly due to the default Rust error having a message, description, and a cause, instead of Go's default error that just has the message. Adding a description and cause is easy enough, and if you defined them for every error in Go, it would probably look pretty similar. My apologies.
- burntsushi 12y ago> I guess my initial reaction of a lot of boilerplate was mainly due to the default Rust error having a message, description, and a cause, instead of Go's default error that just has the message. The `Error` trait in Rust only demands that you define the `description` method.[1] The other two are optional. [1] - http://doc.rust-lang.org/std/error/trait.Error.html http://doc.rust-lang.org/std/error/trait.Error.html