don't hide errors when driver.love connects

The intent of hiding errors is to see if a code change I made improved
things. But many commands from the driver don't involve a code change.
It seems more useful to leave the error up in those situations.
This commit is contained in:
Kartik K. Agaram 2023-11-16 23:12:14 -08:00
parent 90dc7ce6dc
commit ef5e7e0556
1 changed files with 8 additions and 4 deletions

View File

@ -77,8 +77,10 @@ function live.update(dt)
if Current_time - Live.previous_read > 0.1 then
local buf = live.receive_from_driver()
if buf then
live.run(buf)
Mode = 'run'
local possibly_mutated = live.run(buf)
if possibly_mutated then
Mode = 'run'
end
if on.code_change then on.code_change() end
end
Live.previous_read = Current_time
@ -130,7 +132,7 @@ function reset_terminal()
return '\027[m'
end
-- define or undefine top-level bindings
-- returns true if we might have mutated the app, by either creating or deleting a definition
function live.run(buf)
local cmd = live.get_cmd_from_buffer(buf)
assert(cmd)
@ -159,6 +161,7 @@ function live.run(buf)
Live.filename[definition_name] = nil
end
live.send_to_driver('{}')
return true
elseif cmd == 'GET' then
local definition_name = buf:match('^%s*%S+%s+(%S+)')
local val, _ = live.get_binding(definition_name)
@ -219,13 +222,14 @@ function live.run(buf)
if err2 then
-- throw an error
live.send_to_driver('ERROR '..tostring(err..'\n\n'..err2))
return
return true
end
end
-- run all tests
Test_errors = {}
App.run_tests(record_error_by_test)
live.send_to_driver(json.encode(Test_errors))
return true
end
end