forked from hans/Nominatim
fix error message for non-existing database
This commit is contained in:
@@ -65,6 +65,8 @@ class NominatimV1:
|
||||
result = await self.api.status()
|
||||
|
||||
self.format_response(req, resp, result)
|
||||
if result.status and req.context.format == 'text':
|
||||
resp.status = 500
|
||||
|
||||
|
||||
def get_application(project_dir: Path,
|
||||
|
||||
@@ -61,7 +61,13 @@ async def extract_format(request: sanic.Request) -> Optional[sanic.HTTPResponse]
|
||||
async def status(request: sanic.Request) -> sanic.HTTPResponse:
|
||||
""" Implementation of status endpoint.
|
||||
"""
|
||||
return api_response(request,await request.app.ctx.api.status())
|
||||
result = await request.app.ctx.api.status()
|
||||
response = api_response(request, result)
|
||||
|
||||
if request.ctx.format == 'text' and result.status:
|
||||
response.status = 500
|
||||
|
||||
return response
|
||||
|
||||
|
||||
def get_application(project_dir: Path,
|
||||
|
||||
@@ -60,7 +60,12 @@ async def on_status(request: Request) -> Response:
|
||||
"""
|
||||
parse_format(request, StatusResult, 'text')
|
||||
result = await request.app.state.API.status()
|
||||
return format_response(request, result)
|
||||
response = format_response(request, result)
|
||||
|
||||
if request.state.format == 'text' and result.status:
|
||||
response.status_code = 500
|
||||
|
||||
return response
|
||||
|
||||
|
||||
V1_ROUTES = [
|
||||
|
||||
Reference in New Issue
Block a user