Commit 3dcc0113 authored by Guillaume Risbourg's avatar Guillaume Risbourg Committed by Vincent A

[cmso] Raise BrowserUnavailable when HistoryPage contains an exception

The exception is temporary and retrying usually fix the error.
parent 93ddb75f
......@@ -26,6 +26,7 @@ import datetime as dt
from collections import OrderedDict
from weboob.exceptions import BrowserUnavailable
from weboob.browser.pages import HTMLPage, JsonPage, RawPage, LoggedPage, pagination
from weboob.browser.elements import DictElement, ItemElement, TableElement, SkipItem, method
from weboob.browser.filters.standard import CleanText, Upper, Date, Regexp, Format, CleanDecimal, Filter, Env, Slugify, Field
......@@ -334,6 +335,13 @@ class HistoryPage(LoggedPage, JsonPage):
return requests.Request('POST', data=json.dumps(data), headers={'Content-Type': 'application/json'})
def parse(self, el):
exception = Dict('exception', default=None)(self)
if exception:
message = exception.get('message', '')
assert 'SERVICE_INDISPONIBLE' in message, 'Unknown error in history page: "%s"' % message
# The error message is a stack trace so we do not
# send it.
raise BrowserUnavailable()
# Key only if coming
key = Env('key', default=None)(self)
if key:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment