Skip to main content

normalize_error_code

Function normalize_error_code 

Source
pub fn normalize_error_code(code: &str) -> String
Expand description

Normalize a user-typed error code to its canonical AUTHS-E#### form.

Accepts the fully-qualified form and the shorthands people actually type: E4203, 4203, auths-e4203 all resolve to AUTHS-E4203. Anything that is not a bare numeric code is upper-cased and passed through unchanged.

Args:

  • code: the raw code string from the CLI.

Usage:

assert_eq!(normalize_error_code("E4203"), "AUTHS-E4203");