From ade68ff6bf30d1462ea107d44b33377cef77ec33 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 6 Jun 2021 15:21:51 +0530 Subject: throw 404 code --- app/apis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/apis.py b/app/apis.py index 4c6c3fe..f50d403 100644 --- a/app/apis.py +++ b/app/apis.py @@ -1,6 +1,6 @@ from api import app from app import models -from fastapi import Body, FastAPI +from fastapi import Body, FastAPI, HTTPException from fastapi.middleware.wsgi import WSGIMiddleware from pydantic import BaseModel @@ -14,7 +14,7 @@ async def API_User_Details(email: str): try: assert user != None except AssertionError: - return {"message": "User Not Found"} + raise HTTPException(status_code=404, detail="User Not Found") return { "first_name":user.first_name, "last_name":user.last_name} \ No newline at end of file -- cgit v1.2.3