i have the following function that i am trying to handle the errors for and send them to sentry
import sentry_sdk
...
...
...
def create_orders(
orders: orders_schema.OrderCreate
):
try:
query = "INSERT INTO orders VALUES (nextval('orders_id_seq'), :price, :currency, :created_on, :note)"
values = {
"price": orders.price,
"currency": orders.currency,
"created_on": datetime.utcnow(),
"note": orders.note
}
except Exception as err:
sentry_sdk.capture_exception(err)
return database.execute(query, values=values)
here is the router endpoint calling the function
@router.post("/orders/create", response_model=orders_schema.OrderCreate)
async def create_new_order(
orders: orders_schema.OrderCreate
):
await crud.create_orders(orders)
return {**orders.dict()}
Sentry integration works as i have tested receiving some other unhandled error event, but now i want to actually use sentry for what i need it for; which is to help manage handled errors
but when i try to send wrong values or wrong key to the api endpoint, nothing is sent to sentry
am i missing something or what do i do to be able to send the errors?