Skip to content

Bug: division by zero returns 500 instead of a user-friendly error #4

Description

@ascerra

Description

Sending a division request with b: 0 causes an unhandled ZeroDivisionError that returns a raw 500 Internal Server Error to the client.

Steps to reproduce

curl -X POST http://localhost:5000/divide -H "Content-Type: application/json" -d '{"a": 10, "b": 0}'

Expected behavior

Should return 400 Bad Request with a clear message: {"error": "division by zero is not allowed"}.

Actual behavior

Returns 500 Internal Server Error with a Python traceback (in debug mode) or an empty error page.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions