ask user to check db when graphs fail to load

This commit is contained in:
Damien Elmes 2020-07-24 09:56:28 +10:00
parent 6af5cb9f38
commit 80a2bfa642
3 changed files with 11 additions and 8 deletions

View File

@ -163,7 +163,7 @@ def allroutes(pathin):
# review screen before an image had finished
# downloading
return flask.make_response(
"For path '%s - %s' %s!" % (directory, path, error),
str(error),
HTTPStatus.INTERNAL_SERVER_ERROR,
)
@ -204,9 +204,4 @@ def _redirectWebExports(path):
def graph_data(col: Collection, search: str, days: int) -> bytes:
try:
return col.backend.graphs(search=search, days=days)
except Exception as e:
# likely searching error
print(e)
return b""
return col.backend.graphs(search=search, days=days)

View File

@ -177,3 +177,6 @@ statistics-elapsed-time-months = {$amount}mo
statistics-elapsed-time-years = {$amount}y
##
statistics-error-fetching = Invalid data found - please use Check Database to fix the problem.

View File

@ -38,7 +38,12 @@
const refresh = async () => {
refreshing = true;
sourceData = await getGraphData(search, days);
try {
sourceData = await getGraphData(search, days);
} catch (e) {
sourceData = null;
alert(i18n.tr(i18n.TR.STATISTICS_ERROR_FETCHING));
}
refreshing = false;
};