0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 11:03:48 +01:00

Log more information when printer/* endpoint operations fail.

This commit is contained in:
Wouter R 2016-03-11 15:58:35 +01:00
parent f0c839ffdc
commit 260fac9cd4

View File

@ -42,7 +42,7 @@ function M.temperature(request, response)
response:addData('bed_target', temperatures.bed_target) response:addData('bed_target', temperatures.bed_target)
elseif temperatures == false then elseif temperatures == false then
response:addData('status', msg) response:addData('status', msg)
response:setFail() response:setFail("could not get temperature information (" .. msg .. ")")
else else
response:setError(msg) response:setError(msg)
end end
@ -66,7 +66,7 @@ function M.progress(request, response)
response:addData('max_buffer_size', maxBufferSize) response:addData('max_buffer_size', maxBufferSize)
elseif progress == false then elseif progress == false then
response:addData('status', bufferedLines) response:addData('status', bufferedLines)
response:setFail() response:setFail("could not get progress information (" .. bufferedLines .. ")")
else else
response:setError(bufferedLines) response:setError(bufferedLines)
end end
@ -138,7 +138,7 @@ function M.heatup_POST(request, response)
response:setSuccess() response:setSuccess()
elseif rv == false then elseif rv == false then
response:addData('status', msg) response:addData('status', msg)
response:setFail() response:setFail("could not start heatup (" .. msg .. ")")
else else
response:setError(msg) response:setError(msg)
end end
@ -167,7 +167,7 @@ function M.stop_POST(request, response)
response:setSuccess() response:setSuccess()
elseif rv == false then elseif rv == false then
response:addData('status', msg) response:addData('status', msg)
response:setFail() response:setFail("could not stop print (" .. msg .. ")")
else else
response:setError(msg) response:setError(msg)
end end
@ -227,7 +227,7 @@ function M.print_POST(request, response)
if rv == false then if rv == false then
response:addData('status', msg) response:addData('status', msg)
response:setFail("could not clear gcode") response:setFail("could not clear gcode (" .. msg .. ")")
elseif rv == nil then elseif rv == nil then
response:setError(msg) response:setError(msg)
return return
@ -242,11 +242,11 @@ function M.print_POST(request, response)
response:addData('gcode_append',argGcode:len()) response:addData('gcode_append',argGcode:len())
elseif rv == false then elseif rv == false then
response:addData('status', msg) response:addData('status', msg)
response:setFail("could not add gcode") response:setFail("could not add gcode (" .. msg .. ")")
return return
else else
response:addData('msg', msg) response:addData('msg', msg)
response:setError("could not add gcode") response:setError("could not add gcode (" .. msg .. ")")
return return
end end
@ -258,11 +258,11 @@ function M.print_POST(request, response)
response:addData('gcode_print',true) response:addData('gcode_print',true)
elseif rv == false then elseif rv == false then
response:addData('status', msg) response:addData('status', msg)
response:setFail("could not send gcode") response:setFail("could not send gcode (" .. msg .. ")")
return return
else else
response:addData('msg', msg) response:addData('msg', msg)
response:setError("could not send gcode") response:setError("could not send gcode (" .. msg .. ")")
return return
end end
else else