Skip to content

Commit

Permalink
feat: allow modifying match from error handler res
Browse files Browse the repository at this point in the history
  • Loading branch information
martonlederer committed Nov 27, 2024
1 parent c9886b6 commit 9179302
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion process/handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,12 @@ function handlers.evaluate(msg, env)
local status, err = pcall(o.handle, msg, env)
if not status then
if not o.errorHandler then error(err)
else pcall(o.errorHandler, msg, env, err) end
else
local errorHandlerRes = o.errorHandler(msg, env, err)
if errorHandlerRes == "break" or errorHandlerRes == -1 or (errorHandlerRes ~= nil and not errorHandlerRes) then
match = -1
end
end
end
-- remove handler if maxRuns is reached. maxRuns can be either a number or "inf"
if o.maxRuns ~= nil and o.maxRuns ~= "inf" then
Expand Down

0 comments on commit 9179302

Please sign in to comment.