InetIntel / InetIntel/grip-api-v2

Error handling in GRIP-api

Open
#5 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Currently the API does not return specific error codes (it is either a 200 or a 500 internal server error).

The following cases should be handled for the API endpoints:
* When the format of the event id is wrong (400) (Reference for format of event IDs are in grip-core (grip/events/pfxevent.py, grip/events/details_.py)
* When the format is fine, but the event does not exist (404)
* '/pfx_event/id//': **Note:** Check if event ID is available and if the prefix is available and valid too (all permutations) - prefix validity (400) and whether it does not belong to this event (404) (You can use ip address library to check validity of prefix)
* When the elasticsearch instance is down (should be 500 or 503 - check this once, service unavailable)
* Have a common function to check for event ID validity.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the API endpoints, especially /pfx_event/id//, and read the event ID references in grip/events/pfxevent.py and grip/events/details_.py. Identify or add a shared event ID validation path, then verify responses for malformed IDs, missing events or prefixes, invalid prefixes, and unavailable Elasticsearch with the specified status codes.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, flask, python
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.