From 36a63e27c122bd47ff3deb96e6adb5a1ad76da3c Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Fri, 18 Mar 2022 16:32:00 +0800 Subject: [PATCH] Log which method caused `Failed to fetch` --- ui/lbry.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/lbry.js b/ui/lbry.js index 337b76266..71ed55900 100644 --- a/ui/lbry.js +++ b/ui/lbry.js @@ -1,4 +1,5 @@ // @flow +import analytics from 'analytics'; import { NO_AUTH, X_LBRY_AUTH_TOKEN } from 'constants/token'; require('proxy-polyfill'); @@ -246,7 +247,12 @@ export function apiCall(method: string, params: ?{}, resolve: Function, reject: const error = response.error || (response.result && response.result.error); return error ? reject(error) : resolve(response.result); }) - .catch(reject); + .catch((err) => { + if (err.message === 'Failed to fetch') { + analytics.error(`\`${method}\`: Failed to fetch`); + } + return reject(err); + }); } function daemonCallWithResult(