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

Errors in watch_for_file_changes are handled by crashing #30

Open
blobbyblob opened this issue May 12, 2018 · 0 comments
Open

Errors in watch_for_file_changes are handled by crashing #30

blobbyblob opened this issue May 12, 2018 · 0 comments

Comments

@blobbyblob
Copy link

When an error is encountered in the callback for watch_for_file_changes, the program will crash saying lua5.1.exe has stopped working rather than providing a useful error message. Repro:

require("winapi")

watcher, err = winapi.watch_for_file_changes(
	".",
	winapi.FILE_NOTIFY_CHANGE_LAST_WRITE,
	false,
	function() oops_not_a_function(); end
);

local file = io.open("out.txt", "w")
file:write("foobar")
file:close()

winapi.sleep(100)

A similar experience can be had by passing in nil for the function callback.

It would be much more useful if the error would be handled like errors encountered during regular execution, that is, providing a message: "test.lua:7: attempt to call global 'oops_not_a_function' (a nil value)"

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

No branches or pull requests

1 participant