1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00
This commit is contained in:
checktheroads
2020-04-18 23:19:12 -07:00
parent 945059a0ed
commit 21c636a273
2 changed files with 8 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ from pathlib import Path
# Third Party # Third Party
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError from fastapi.exceptions import ValidationError, RequestValidationError
from starlette.responses import JSONResponse from starlette.responses import JSONResponse
from starlette.exceptions import HTTPException as StarletteHTTPException from starlette.exceptions import HTTPException as StarletteHTTPException
from fastapi.openapi.utils import get_openapi from fastapi.openapi.utils import get_openapi
@@ -23,8 +23,8 @@ from hyperglass.api.routes import (
query, query,
queries, queries,
routers, routers,
import_certificate,
communities, communities,
import_certificate,
) )
from hyperglass.exceptions import HyperglassError from hyperglass.exceptions import HyperglassError
from hyperglass.configuration import URL_DEV, STATIC_PATH, params, devices from hyperglass.configuration import URL_DEV, STATIC_PATH, params, devices
@@ -98,9 +98,12 @@ app.add_exception_handler(StarletteHTTPException, http_handler)
# Backend Application Error Handler # Backend Application Error Handler
app.add_exception_handler(HyperglassError, app_handler) app.add_exception_handler(HyperglassError, app_handler)
# Validation Error Handler # Request Validation Error Handler
app.add_exception_handler(RequestValidationError, validation_handler) app.add_exception_handler(RequestValidationError, validation_handler)
# App Validation Error Handler
app.add_exception_handler(ValidationError, validation_handler)
# Uncaught Error Handler # Uncaught Error Handler
app.add_exception_handler(Exception, default_handler) app.add_exception_handler(Exception, default_handler)
@@ -247,5 +250,4 @@ def start(**kwargs):
"""Start the web server with Uvicorn ASGI.""" """Start the web server with Uvicorn ASGI."""
import uvicorn import uvicorn
options = {**ASGI_PARAMS, **kwargs} uvicorn.run("hyperglass.api:app", **ASGI_PARAMS, **kwargs)
uvicorn.run("hyperglass.api:app", **options)

View File

@@ -139,7 +139,7 @@ class Text(HyperglassModel):
query_vrf: StrictStr = "Routing Table" query_vrf: StrictStr = "Routing Table"
fqdn_tooltip: StrictStr = "Use {protocol}" # Formatted by Javascript fqdn_tooltip: StrictStr = "Use {protocol}" # Formatted by Javascript
cache_prefix: StrictStr = "Results cached for " cache_prefix: StrictStr = "Results cached for "
cache_icon: StrictStr = "Cached Response from {time} UTC" # Formatted by Javascript cache_icon: StrictStr = "Cached from {time} UTC" # Formatted by Javascript
complete_time: StrictStr = "Completed in {seconds}" # Formatted by Javascript complete_time: StrictStr = "Completed in {seconds}" # Formatted by Javascript
@validator("title_mode") @validator("title_mode")