main
Tool Inventory API.
This module initializes the FastAPI application and sets up the routes, exception handlers, and static file serving for the tool inventory application.
lifespan
async
¶
Manage the lifespan of the application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_app
|
FastAPI
|
The FastAPI application. |
required |
Yields:
| Type | Description |
|---|---|
AsyncGenerator[None]
|
None |
Source code in src/tool_inventory/main.py
object_exists_error_handler
async
¶
Handle ObjectExistsError exceptions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_request
|
Request
|
The request object. |
required |
exc
|
ObjectExistsError
|
The ObjectExistsError exception. |
required |
Returns:
| Type | Description |
|---|---|
JSONResponse
|
A JSON response with the error details. |
Source code in src/tool_inventory/main.py
object_not_found_error_handler
async
¶
Handle ObjectNotFoundError exceptions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_request
|
Request
|
The request object. |
required |
exc
|
ObjectNotFoundError
|
The ObjectNotFoundError exception. |
required |
Returns:
| Type | Description |
|---|---|
JSONResponse
|
A JSON response with the error details. |
Source code in src/tool_inventory/main.py
validation_error_handler
async
¶
Handle ValidationError exceptions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_request
|
Request
|
The request object. |
required |
exc
|
ValidationError
|
The ValidationError exception. |
required |
Returns:
| Type | Description |
|---|---|
JSONResponse
|
A JSON response with the error details. |