Skip to content

Commit

Permalink
add proper error handling, e.g.:
Browse files Browse the repository at this point in the history
```
{
    "message": "node is not connected, node_id: 2857f140-4ef6-43b0-b8e0-d33c1ae5b5ed"
}
```
  • Loading branch information
dndx committed Mar 26, 2024
1 parent 38d1162 commit 78d2f57
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kong/api/routes/debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ local routes = {
},
["/debug/node/:node_id/node/log-level"] = {
GET = function(self)
return kong.response.exit(200, { level = LOG_LEVELS[kong.rpc:call(self.params.node_id, "kong.debug.v1.get_log_level")] })
local res, err = kong.rpc:call(self.params.node_id, "kong.debug.v1.get_log_level")
if not res then
return kong.response.exit(500, { message = err })
end

return kong.response.exit(200, { level = LOG_LEVELS[res], })
end,
},
["/debug/node/:node_id/node/log-level/:log_level"] = {
Expand Down

0 comments on commit 78d2f57

Please sign in to comment.