Skip to main content

gen_go_sentinel_errors

Function gen_go_sentinel_errors 

Source
pub fn gen_go_sentinel_errors(errors: &[ErrorDef]) -> String
Expand description

Generate a single consolidated var (...) block of Go sentinel errors across multiple ErrorDefs.

When the same variant name appears in more than one ErrorDef (e.g. both GraphQLError and SchemaError define ValidationError), the colliding const names are disambiguated by prefixing with the parent error type’s stripped base name. For example, GraphQLError::ValidationError and SchemaError::ValidationError become ErrGraphQLValidationError and ErrSchemaValidationError. Variant names that are unique across all errors are emitted as plain Err{Variant} consts.