Skip to content

Commit 1835f93

Browse files
committed
Improve the decode error message in the Heka file.lua input
1 parent d1c067d commit 1835f93

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

heka/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
44

55
cmake_minimum_required(VERSION 3.0)
6-
project(heka VERSION 1.1.14 LANGUAGES C)
6+
project(heka VERSION 1.1.15 LANGUAGES C)
77
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Utility modules for Heka sandboxes")
88
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${PACKAGE_PREFIX}-cjson (>= 2.1)")
99
string(REGEX REPLACE "[()]" "" CPACK_RPM_PACKAGE_REQUIRES ${CPACK_DEBIAN_PACKAGE_DEPENDS})

heka/sandboxes/heka/input/file.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,18 @@ end
4747
local send_decode_failures = read_config("send_decode_failures")
4848

4949
local err_msg = {
50-
Type = "error",
50+
Type = "error.decode",
5151
Payload = nil,
52+
Fields = {
53+
data = nil
54+
}
5255
}
5356

5457
function process_message(checkpoint)
5558
local fh = io.stdin
5659
if input_filename then
5760
fh = assert(io.open(input_filename, "rb")) -- closed on plugin shutdown
58-
if checkpoint then
61+
if checkpoint then
5962
fh:seek("set", checkpoint)
6063
else
6164
checkpoint = 0
@@ -67,6 +70,7 @@ function process_message(checkpoint)
6770
local ok, err = pcall(decode, data, default_headers)
6871
if (not ok or err) and send_decode_failures then
6972
err_msg.Payload = err
73+
err_msg.Fields.data = data
7074
pcall(inject_message, err_msg)
7175
end
7276

0 commit comments

Comments
 (0)