dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Improve error handling in `dx fmt`

Open matthunz opened this issue 1 year ago • 0 comments

Feature Request

Currently when dx fmt fails, I usually see a panic with little indication to what's causing the error. While formatting is being worked out I think it'd be helpful to see a line number and maybe a section of the code causing the error, so we can all help narrow down formatting bugs.

Implement Suggestion

Replace .unwrap() by returning a custom error type that wraps anyhow::Error. Maybe something like

pub struct Error {
  span: Option<Span>,
  cause: anyhow::Error
}

matthunz avatar Apr 04 '24 16:04 matthunz