From 00db37f06430b728bd36e92aeab6211a6fe8d09f Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 3 Jan 2022 08:20:05 -0800 Subject: [PATCH] toot-toot: gracefully handle lack of permissions This opens up a whole new can of worms: Teliva's ability to show clear error messages hinges on apps having decent error handling. I suppose that's ok. A new app someone downloads that throws out strange error messages and puts them in the equivalent of the console doesn't exactly engender trust. It's reasonable to treat poor error handling as breakage. Here's my running list of open questions from working on the permissions screen so far: - how to teach people to care about the difference between: - permissions known to be unsafe - permissions unknown to be safe - how to show syntax errors in the permissions screen - how to detect syntax errors in the permissions screen (lots of stuff only shows up when running) - how to deal with apps with poor error handling (this commit; punt for now) - how to engender skepticism in people towards what apps tell them ("oh, just go into the permissions screen and type ___ to fix this error") - how to help people judge the quality of their permissions (mode == 'r' vs mode ~= 'w') --- toot-toot.tlv | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/toot-toot.tlv b/toot-toot.tlv index eca7b74..15d1742 100644 --- a/toot-toot.tlv +++ b/toot-toot.tlv @@ -312,8 +312,10 @@ > cursor = 1 > elseif key == 23 then -- ctrl-w > local out = io.open('toot', 'w') - > out:write(prose, '\n') - > out:close() + > if out ~= nil then + > out:write(prose, '\n') + > out:close() + > end > elseif key == 10 or (key >= 32 and key < 127) then > prose = prose:insert(string.char(key), cursor-1) > cursor = cursor+1