Skip to content

Incorrect error handling for empty payloads #13

Description

@TomeRobertshaw

content: The handle_payload function in payload_handler.py does not correctly catch and handle empty payloads, leading to unhandled exceptions.
file: app/handlers/payload_handler.py
code:

def handle_payload(payload):
    parsed_data = json.loads(payload)
    process_data(parsed_data)

description: When payload is an empty string or None, json.loads raises a JSONDecodeError which is not caught. This causes the entire request to fail instead of returning a meaningful error response. Add checks for empty payloads and wrap json.loads in a try-except block.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions