Skip to content

Commit

Permalink
chore(pdk): set stack rewind to 3 to display the correct line when do…
Browse files Browse the repository at this point in the history
…ing phase check
  • Loading branch information
fffonion authored Oct 30, 2024
1 parent 13fb553 commit 798d72c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kong/pdk/private/phases.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ local function check_phase(accepted_phases)
current_phase = PHASES.admin_api
else
error(fmt("no phase in ngx.ctx.KONG_PHASE, (need one of %s)",
table.concat(get_phases_names(accepted_phases), ", ")))
table.concat(get_phases_names(accepted_phases), ", ")), 3)
end
end

Expand All @@ -89,7 +89,7 @@ local function check_phase(accepted_phases)

error(fmt("function cannot be called in %s phase (only in: %s)",
current_phase_name,
table.concat(accepted_phases_names, ", ")))
table.concat(accepted_phases_names, ", ")), 3)
end


Expand All @@ -101,7 +101,7 @@ local function check_not_phase(rejected_phases)

local current_phase = ngx.ctx.KONG_PHASE
if not current_phase then
error("no phase in ngx.ctx.KONG_PHASE")
error("no phase in ngx.ctx.KONG_PHASE", 3)
end

if band(current_phase, rejected_phases) == 0 then
Expand All @@ -114,7 +114,7 @@ local function check_not_phase(rejected_phases)
error(fmt("function cannot be called in %s phase (can be called in any " ..
"phases except: %s)",
current_phase_name,
table.concat(rejected_phases_names, ", ")))
table.concat(rejected_phases_names, ", ")), 3)
end


Expand Down

0 comments on commit 798d72c

Please sign in to comment.