Skip to main content

format_panic_message

Function format_panic_message 

Source
pub fn format_panic_message(error: &Box<dyn Any + Send>) -> String
Expand description

Extract a plain-text error message from a caught panic payload.

ANSI codes are stripped before the prefix check so that colored StyleXError payloads are detected correctly. The returned string is always plain text, safe to pass to the NAPI boundary or non-TTY logs.

If the stripped message contains [StyleX], it is returned as-is. Otherwise, it is wrapped as [StyleX] <message>.