Skip to content

Commit

Permalink
engine: Detect bad return value from app start() method
Browse files Browse the repository at this point in the history
Raise a specific error instead of allowing a bad value to propagate in
the engine (leading to a more confusing error message).
  • Loading branch information
lukego committed Jan 22, 2016
1 parent d0fff55 commit 9a31a6f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ function apply_config_actions (actions, conf)
local class = conf.apps[name].class
local arg = conf.apps[name].arg
local app = class:new(arg)
if type(app) ~= 'table' then
error(("bad return value from app '%s' start() method: %s"):format(
name, tostring(app)))
end
local zone = app.zone or getfenv(class.new)._NAME or name
app.appname = name
app.output = {}
Expand Down

0 comments on commit 9a31a6f

Please sign in to comment.