Skip to content

Commit

Permalink
API: return error when no ports found
Browse files Browse the repository at this point in the history
When looking up device ports (get_port_graphs), return an error when no ports are found.

fixes librenms#15964
  • Loading branch information
murrant committed May 19, 2024
1 parent ceb0bf7 commit e1ed93c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions includes/html/api_functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,10 @@ function get_port_graphs(Illuminate\Http\Request $request): JsonResponse
$ports = $device->ports()->isNotDeleted()->hasAccess(Auth::user())
->select($columns)->orderBy('ifIndex')->get();

if ($ports->isEmpty()) {
return api_error(404, 'No ports found');
}

return api_success($ports, 'ports');
}

Expand Down

0 comments on commit e1ed93c

Please sign in to comment.