mainframe.custom_exceptions

Exceptions

BadCredentialsException

An HTTP exception you can raise in your own code to show errors to the client.

PermissionDeniedException

An HTTP exception you can raise in your own code to show errors to the client.

RequiresAuthenticationException

An HTTP exception you can raise in your own code to show errors to the client.

UnableCredentialsException

An HTTP exception you can raise in your own code to show errors to the client.

Module Contents

exception mainframe.custom_exceptions.BadCredentialsException[source]

Bases: fastapi.HTTPException

An HTTP exception you can raise in your own code to show errors to the client.

This is for client errors, invalid authentication, invalid data, etc. Not for server errors in your code.

Read more about it in the [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).

## Example

```python from fastapi import FastAPI, HTTPException

app = FastAPI()

items = {“foo”: “The Foo Wrestlers”}

@app.get(“/items/{item_id}”) async def read_item(item_id: str):

if item_id not in items:

raise HTTPException(status_code=404, detail=”Item not found”)

return {“item”: items[item_id]}

```

exception mainframe.custom_exceptions.PermissionDeniedException[source]

Bases: fastapi.HTTPException

An HTTP exception you can raise in your own code to show errors to the client.

This is for client errors, invalid authentication, invalid data, etc. Not for server errors in your code.

Read more about it in the [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).

## Example

```python from fastapi import FastAPI, HTTPException

app = FastAPI()

items = {“foo”: “The Foo Wrestlers”}

@app.get(“/items/{item_id}”) async def read_item(item_id: str):

if item_id not in items:

raise HTTPException(status_code=404, detail=”Item not found”)

return {“item”: items[item_id]}

```

exception mainframe.custom_exceptions.RequiresAuthenticationException[source]

Bases: fastapi.HTTPException

An HTTP exception you can raise in your own code to show errors to the client.

This is for client errors, invalid authentication, invalid data, etc. Not for server errors in your code.

Read more about it in the [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).

## Example

```python from fastapi import FastAPI, HTTPException

app = FastAPI()

items = {“foo”: “The Foo Wrestlers”}

@app.get(“/items/{item_id}”) async def read_item(item_id: str):

if item_id not in items:

raise HTTPException(status_code=404, detail=”Item not found”)

return {“item”: items[item_id]}

```

exception mainframe.custom_exceptions.UnableCredentialsException[source]

Bases: fastapi.HTTPException

An HTTP exception you can raise in your own code to show errors to the client.

This is for client errors, invalid authentication, invalid data, etc. Not for server errors in your code.

Read more about it in the [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).

## Example

```python from fastapi import FastAPI, HTTPException

app = FastAPI()

items = {“foo”: “The Foo Wrestlers”}

@app.get(“/items/{item_id}”) async def read_item(item_id: str):

if item_id not in items:

raise HTTPException(status_code=404, detail=”Item not found”)

return {“item”: items[item_id]}

```