summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2017-10-05 11:41:59 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2017-10-05 11:41:59 +0200
commit12f8efe0128ade1bd6497a59508f6bd836eb3788 (patch)
tree33ed18e8d90bcd8cdb92d9affcd4ff6145855bbc /data
parent2262f005ce5b39ccd3694f61f2507b9e61c3804c (diff)
pandoc.lua: throw better error when pipe command fails
A table containing the error code, command, and command output is thrown instead of just a string error message.
Diffstat (limited to 'data')
-rw-r--r--data/pandoc.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua
index fc83103e0..32e593c22 100644
--- a/data/pandoc.lua
+++ b/data/pandoc.lua
@@ -792,6 +792,8 @@ end
--- Runs command with arguments, passing it some input, and returns the output.
-- @treturn string Output of command.
+-- @raise A table containing the keys `command`, `error_code`, and `output` is
+-- thrown if the command exits with a non-zero error code.
-- @usage
-- local ec, output = pandoc.pipe("sed", {"-e","s/a/b/"}, "abc")
function M.pipe (command, args, input)
@@ -806,9 +808,7 @@ function M.pipe (command, args, input)
end
}
)
- -- TODO: drop the wrapping call to `tostring` as soon as hslua supports
- -- non-string error objects.
- error(tostring(err))
+ error(err)
end
return output
end