diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index e88e5f7..acf75eb 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -84,7 +84,7 @@ The project uses [Hypothesis](https://hypothesis.readthedocs.io) for property-ba Project Documentation is written in Markdown and built using [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/). API documentation is built from docstrings using [mkdocstrings](https://mkdocstrings.github.io/). -To preview the documentation on your local, run: +To preview the documentation locally, run: ```bash mise run local ``` @@ -96,7 +96,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform - Make sure that you are using the latest version. - Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions. -- Search exisitng issues to see if other users have experienced (and potentially already solved) the same issue you are having. +- Search existing issues to see if other users have experienced (and potentially already solved) the same issue you are having. - Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. - Collect information about the bug, e.g., Stack trace (Traceback), OS, platform, and version, .. etc diff --git a/templates/api/handler.py b/templates/api/handler.py index 7d036f7..d6d3e95 100644 --- a/templates/api/handler.py +++ b/templates/api/handler.py @@ -31,7 +31,7 @@ def get_item(id: str) -> Response: """ try: if (item := repository.get_item(id)) is None: - return JsonResponse({"message": "Not found"}, status_code=404) + return JsonResponse({"message": f"Item '{id}' not found"}, status_code=404) item = Item.model_validate(item) # Validate model after retrieval to ensure data integrity except Exception as exc: message = "Item validation failed" if isinstance(exc, ValidationError) else "Error retrieving item" diff --git a/tests/api/test_handler.py b/tests/api/test_handler.py index 19c3a78..76ea911 100644 --- a/tests/api/test_handler.py +++ b/tests/api/test_handler.py @@ -95,6 +95,8 @@ def test_get_item_not_found(mock_repo, lambda_context): response = handler_module.main(event, lambda_context) assert response["statusCode"] == 404 + body = loads(response["body"]) + assert body["message"] == "Item 'missing' not found" def test_post_item_invalid_body(mock_repo, lambda_context):