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

Fix require not throwing syntax error #168

Merged
merged 8 commits into from
Apr 15, 2024
Merged

Fix require not throwing syntax error #168

merged 8 commits into from
Apr 15, 2024

Conversation

Someon1e
Copy link
Contributor

Fixes #139

@CompeyDev
Copy link
Contributor

🙏 Thank you for this PR - this pretty simple bug does get quite annoying at times, but I had been procrastinating actually PR'ing a fix for it.

@filiptibell
Copy link
Collaborator

Thank you for the PR! Took a look through and it seems good - but I'm wondering if maybe we should go about this a bit differently? With this PR we are checking specifically against syntax errors and returning those early, when we should probably be checking for anything that's not a "file doesn't exist" error and falling through to the next path if we get one of those 🤔

Copy link
Collaborator

@filiptibell filiptibell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we need to also check for if the error is an "is a directory" error for the first few branches, otherwise requiring dir/init.lua and dir/init.luau as require("dir") below stops working (https://github.com/lune-org/lune/actions/runs/8603776567/job/23634709137?pr=168)

@filiptibell filiptibell merged commit 3f79756 into lune-org:main Apr 15, 2024
5 checks passed
@filiptibell
Copy link
Collaborator

Thank you!

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.

"require" function throw error "File not exist" when required module has syntax error
3 participants