Skip to main content

classify_header_error

Function classify_header_error 

Source
pub fn classify_header_error(err: &str) -> (Color, String)
Expand description

Classify a header-line error message into a render colour + a friendlier prefix. Bee returns HTTP 503: Node is syncing. This endpoint is unavailable. Try again later. for almost every endpoint during the first few minutes after startup; rendering that in red as a hard error gives a terrible first impression. We detect the syncing case and render it in warn colour with a one-sentence explanation.

Returned tuple: (colour, formatted message ready to render).