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

assets: add an error to ob run when file doesn't exist #930

Merged
merged 4 commits into from
May 25, 2022

Conversation

ali-abrar
Copy link
Member

@ali-abrar ali-abrar commented May 23, 2022

Before this PR, and since #831, calling static with a nonexistent file would not result in an error or a warning in ob run, but would fail at compile-time when using ob deploy or nix-build.

This PR adds errors like the following to static in ob run:

frontend/src/Frontend.hs:45:32-55: error:
    • Static file obeliskasdf.jpg was not found in static.out
    • In the untyped splice: $(static "obeliskasdf.jpg")
   |
45 |       elAttr "img" ("src" =: $(static "obeliskasdf.jpg"))
blank
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^

Notes:

  • Since nix-derived assets are built asynchronously, this error might be reported because the nix-build of the static assets isn't ready yet. The user would have trigger a ghci reload (by saving a file) to get rid of the error.
  • The TH error will only be reported when the haskell code is being reloaded. Changing the files in static/ currently does not trigger a ghci reload and won't be noticed.
  • Related PR: Don't wait for nix show-derivation when deciding whether to provide UI feedback #835

I have:

  • Based work on latest develop branch
  • Followed the contribution guide
  • Looked for lint in my changes with hlint . (lint found code you did not write can be left alone)
  • Run the test suite: $(nix-build -A selftest --no-out-link)
  • Updated the changelog
  • (Optional) Run CI tests locally: nix-build release.nix -A build.x86_64-linux --no-out-link (or x86_64-darwin on macOS)

@ali-abrar ali-abrar changed the title assets: add a warning to ob run when file doesn't exist assets: add an error to ob run when file doesn't exist May 24, 2022
ChangeLog.md Outdated Show resolved Hide resolved
@madeline-os madeline-os merged commit bd76ace into develop May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants