Skip to content

Commit 8942de8

Browse files
committed
raise 404
1 parent 8c9ff62 commit 8942de8

File tree

1 file changed

+4
-4
lines changed
  • src/rasenmaeher_api/web/api/instructions

1 file changed

+4
-4
lines changed

src/rasenmaeher_api/web/api/instructions/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import cast, Optional
44
import logging
55

6-
from fastapi import Depends, APIRouter, Request
6+
from fastapi import Depends, APIRouter, Request, HTTPException
77
from libpvarki.schemas.product import UserCRUDRequest, UserInstructionFragment
88

99

@@ -71,8 +71,8 @@ async def get_product_instructions(request: Request, product: str, language: str
7171
endpoint_url = f"api/v1/instructions/{language}"
7272
response = await post_to_product(product, endpoint_url, user.dict(), InstructionData)
7373
if response is None:
74-
LOGGER.error("post_to_product({}, {}): failed".format(product, endpoint_url))
75-
# TODO: Raise a reasonable error instead
76-
return None
74+
_reason = f"Unable to get instructions for {product}"
75+
LOGGER.error("{} : {}".format(request.url, _reason))
76+
raise HTTPException(status_code=404, detail=_reason)
7777
response = cast(InstructionData, response)
7878
return response

0 commit comments

Comments
 (0)