Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A better error message when the specified style is not found #681

Closed
Fil opened this issue Feb 6, 2024 · 5 comments · Fixed by #766
Closed

A better error message when the specified style is not found #681

Fil opened this issue Feb 6, 2024 · 5 comments · Fixed by #766
Assignees
Labels
enhancement New feature or request

Comments

@Fil
Copy link
Contributor

Fil commented Feb 6, 2024

No description provided.

@Fil Fil added the bug Something isn’t working label Feb 6, 2024
@Fil Fil self-assigned this Feb 6, 2024
@Fil
Copy link
Contributor Author

Fil commented Feb 6, 2024

ok I've tried several things (like checking that the source is an actual file and not a directory) — however they only add complexity.

What we want here is only to let the user to know that this problem is due to the style option, which is not obvious from the current message.

bundle docs/ → ✘ [ERROR] Could not resolve "docs/"

A possibility might be to change the message slightly into:

bundle style option docs/ → ✘ [ERROR] Could not resolve "docs/"

We could also catch the error and then add one line of log to say the style option ${style.path} must reference a valid file, then throw. Note that this error is not distinguishable from other potential errors (no error type or errcode that I can see).

@Fil
Copy link
Contributor Author

Fil commented Feb 6, 2024

related: #525

@mythmon
Copy link
Member

mythmon commented Feb 6, 2024

This is crashing build specifically, right? Does it show up when you run "yarn build", or only deploy?

This provides more evidence that we should be separating build and deploy.

@Fil
Copy link
Contributor Author

Fil commented Feb 6, 2024

yes, it crashes the build. In this case it's a good thing that the build errors, but the error message was unclear and it took me a moment to find why it was erroring.

@Fil Fil changed the title setting style: "" crashes deploy setting style: "" crashes build with an unclear error message Feb 6, 2024
@mbostock mbostock added enhancement New feature or request and removed bug Something isn’t working labels Feb 13, 2024
@mbostock mbostock changed the title setting style: "" crashes build with an unclear error message A better error message when the specified style is not found Feb 13, 2024
@mbostock
Copy link
Member

mbostock commented Feb 13, 2024

To clarify the issue description: it’s expected that the build crashes if you reference a stylesheet that does not exist (including the empty string); but we want a better error message when this happens. So this is not a bug (the crashing is desired), but we should enhance the error message.

@Fil Fil closed this as completed in #766 Feb 13, 2024
Fil added a commit that referenced this issue Feb 13, 2024
…tion (#766)

* just a log that clarifies that this bundle emanates from the style option

closes #681

* style

Co-authored-by: Mike Bostock <[email protected]>

---------

Co-authored-by: Mike Bostock <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants