mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-05 18:03:17 +03:00
Merge pull request #1306 from EDCD/fix/eddn-quieten-unknown-schema-errors
EDDN: Quieten "unknown schema" errors
This commit is contained in:
commit
488fdf4976
@ -108,6 +108,11 @@ class EDDN:
|
|||||||
TIMEOUT = 10 # requests timeout
|
TIMEOUT = 10 # requests timeout
|
||||||
MODULE_RE = re.compile(r'^Hpt_|^Int_|Armour_', re.IGNORECASE)
|
MODULE_RE = re.compile(r'^Hpt_|^Int_|Armour_', re.IGNORECASE)
|
||||||
CANONICALISE_RE = re.compile(r'\$(.+)_name;')
|
CANONICALISE_RE = re.compile(r'\$(.+)_name;')
|
||||||
|
UNKNOWN_SCHEMA_RE = re.compile(
|
||||||
|
r"^FAIL: \[JsonValidationException\('Schema "
|
||||||
|
r"https://eddn.edcd.io/schemas/(?P<schema_name>.+)/(?P<schema_version>[0-9]+) is unknown, "
|
||||||
|
r"unable to validate.',\)\]$"
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, parent: tk.Tk):
|
def __init__(self, parent: tk.Tk):
|
||||||
self.parent: tk.Tk = parent
|
self.parent: tk.Tk = parent
|
||||||
@ -212,14 +217,15 @@ class EDDN:
|
|||||||
logger.trace_if('plugin.eddn', "EDDN is still objecting to empty commodities data")
|
logger.trace_if('plugin.eddn', "EDDN is still objecting to empty commodities data")
|
||||||
return # We want to silence warnings otherwise
|
return # We want to silence warnings otherwise
|
||||||
|
|
||||||
logger.debug(
|
if not self.UNKNOWN_SCHEMA_RE.match(r.text):
|
||||||
f'''Status from POST wasn't OK:
|
logger.debug(
|
||||||
|
f'''Status from POST wasn't OK:
|
||||||
Status\t{r.status_code}
|
Status\t{r.status_code}
|
||||||
URL\t{r.url}
|
URL\t{r.url}
|
||||||
Headers\t{r.headers}
|
Headers\t{r.headers}
|
||||||
Content:\n{r.text}
|
Content:\n{r.text}
|
||||||
Msg:\n{msg}'''
|
Msg:\n{msg}'''
|
||||||
)
|
)
|
||||||
|
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
||||||
@ -281,7 +287,13 @@ Msg:\n{msg}'''
|
|||||||
# in question out of replaylog, else we'll keep retrying a bad message
|
# in question out of replaylog, else we'll keep retrying a bad message
|
||||||
# forever.
|
# forever.
|
||||||
except requests.exceptions.HTTPError as e:
|
except requests.exceptions.HTTPError as e:
|
||||||
status['text'] = self.http_error_to_log(e)
|
if unknown_schema := self.UNKNOWN_SCHEMA_RE.match(e.response.text):
|
||||||
|
logger.debug(f"EDDN doesn't (yet?) know about schema: {unknown_schema['schema_name']}"
|
||||||
|
f"/{unknown_schema['schema_version']}")
|
||||||
|
# return # Pretend it went OK so this message isn't retried
|
||||||
|
|
||||||
|
else:
|
||||||
|
status['text'] = self.http_error_to_log(e)
|
||||||
|
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
logger.debug('Failed sending', exc_info=e)
|
logger.debug('Failed sending', exc_info=e)
|
||||||
@ -997,7 +1009,10 @@ def plugin_app(parent: tk.Tk) -> Optional[tk.Frame]:
|
|||||||
|
|
||||||
|
|
||||||
def tracking_ui_update() -> None:
|
def tracking_ui_update() -> None:
|
||||||
"""Update the Tracking UI with current data."""
|
"""Update the Tracking UI with current data, if required."""
|
||||||
|
if not config.eddn_tracking_ui:
|
||||||
|
return
|
||||||
|
|
||||||
this.ui_j_body_name['text'] = '≪None≫'
|
this.ui_j_body_name['text'] = '≪None≫'
|
||||||
if this.body_name is not None:
|
if this.body_name is not None:
|
||||||
this.ui_j_body_name['text'] = this.body_name
|
this.ui_j_body_name['text'] = this.body_name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user