1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

fix reference error

This commit is contained in:
checktheroads
2020-06-03 08:31:17 -07:00
parent 0b9947fed6
commit f3f280cea8
2 changed files with 8 additions and 0 deletions

View File

@@ -79,6 +79,11 @@ class Messages(HyperglassModel):
title="No Output",
description="Displayed when hyperglass can connect to a device and execute a query, but the response is empty.",
)
parsing_error: StrictStr = Field(
"An error occurred while parsing the query output.",
title="Parsing Error",
description="Displayed when hyperglass can connect to a device and execute a query, but the response cannot be parsed.",
)
class Config:
"""Pydantic model configuration."""

View File

@@ -82,6 +82,7 @@ class Connect:
"""
log.debug(f"Pre-parsed responses:\n{output}")
parsed = ()
response = None
if not self.device.structured_output:
for coro in parsers:
for response in output:
@@ -96,6 +97,8 @@ class Connect:
func = nos_parsers[self.device.nos][self.query_type]
response = func(output)
log.debug(f"Post-parsed responses:\n{response}")
if response is None:
raise ResponseEmpty(params.messages.parsing_error)
return response
async def scrape_proxied(self):