Skip to main content

gen_go_error_struct

Function gen_go_error_struct 

Source
pub fn gen_go_error_struct(error: &ErrorDef, pkg_name: &str) -> String
Expand description

Generate the structured error type (struct + Error() method) for a single error definition. Sentinel errors are emitted separately by gen_go_sentinel_errors.

When error.methods is non-empty, each whitelisted introspection method produces an exported struct field of the matching Go type plus a receiver method that returns that field.