stylex icon indicating copy to clipboard operation
stylex copied to clipboard

Errors displaying an error line and part of code

Open prc5 opened this issue 2 months ago • 0 comments

Describe the feature request

After using StyleX for some time, I think it would be great to have some more accurate error messages displaying details like error line and optionally part of the invalid code if that's possible?

Let's take this example:

// some-file.stylex.ts 

// dynamic/incorrect value for stylex
let displayValue = "flex";

const styles = stylex.create({
  base: {
    display: displayValue
  }
})

Current formatting:

Errror: Users/...path.../some-file.stylex.ts Only static values are allowed inside of a stylex.create() call.

New formatting:

Errror: Only static values are allowed inside of a stylex.create() call. Evaluating display: displayValue at Users/...path.../some-file.stylex.ts:43

With the new formatting:

  • Important details are listed first - "What's wrong?" and "Which part?"
  • Longer details which are harder to read are listed at the end showing path and broken line in the code

In my opinion it would make the debugging experience a bit easier and intuitive. 🙏🏻

The current appearance of errors makes me a bit concerned about the "lack of control" over the state of the codebase when I am not receiving enough details. 😅

prc5 avatar Apr 28 '24 12:04 prc5