Skip to main content

classify_error

Function classify_error 

Source
pub fn classify_error(message: &str) -> ErrorCategory
Expand description

Classifies an error message into a category based on keyword matching.

§Arguments

  • message - The error message to classify

§Returns

The most appropriate ErrorCategory for the given error message.

§Examples

use camgrab_core::error::{classify_error, ErrorCategory};

assert_eq!(classify_error("401 Unauthorized"), ErrorCategory::Auth);
assert_eq!(classify_error("connection refused"), ErrorCategory::NetworkRefused);
assert_eq!(classify_error("request timed out"), ErrorCategory::NetworkTimeout);