Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Handle Update - path_finder #262

Merged
merged 11 commits into from
Nov 27, 2024
Prev Previous commit
Next Next commit
update syntax from 500 to 400 error
  • Loading branch information
NikkiBytes committed Aug 7, 2024
commit 9246154ad01ce43e929775ccc333275608e567e2
6 changes: 3 additions & 3 deletions src/handlers/api.py
Original file line number Diff line number Diff line change
@@ -681,9 +681,9 @@ async def get(self, *args, **kwargs):
bte=self.args.bte
)

# Error check path results
if isinstance(paths_with_edges, ValueError):
raise ValueError(str(paths_with_edges))
# # Error check path results
if "error" in paths_with_edges:
raise HTTPError(400, reason=str(paths_with_edges["error"]))

# Check if rawquery parameter is true -- respond with correct output
if self.args.rawquery:
4 changes: 2 additions & 2 deletions src/utils/metakg/path_finder.py
Original file line number Diff line number Diff line change
@@ -143,8 +143,8 @@ def get_paths(self, cutoff=2, api_details=False, predicate_filter=None, bte=Fals
if edge_added:
all_paths_with_edges.append(paths_data)
except nx.exception.NodeNotFound as node_err:
raise ValueError(node_err)
return { "error": node_err }
return all_paths_with_edges

except Exception as e:
return e
return { "error": e }