Show proper error message when Candle analysis fails

closes #1387
This commit is contained in:
Matthias 2023-07-27 06:55:07 +02:00
parent e4a1ec224a
commit ee45a94ec6

View File

@ -362,29 +362,36 @@ export function createBotSubStore(botId: string, botName: string) {
reject(error); reject(error);
}); });
}, },
getPairHistory(payload: PairHistoryPayload) { async getPairHistory(payload: PairHistoryPayload) {
if (payload.pair && payload.timeframe) { if (payload.pair && payload.timeframe) {
this.historyStatus = LoadingStatus.loading; this.historyStatus = LoadingStatus.loading;
return api try {
.get('/pair_history', { const { data } = await api.get('/pair_history', {
params: { ...payload }, params: { ...payload },
timeout: 50000, timeout: 50000,
})
.then((result) => {
this.history = {
[`${payload.pair}__${payload.timeframe}`]: {
pair: payload.pair,
timeframe: payload.timeframe,
timerange: payload.timerange,
data: result.data,
},
};
this.historyStatus = LoadingStatus.success;
})
.catch((err) => {
console.error(err);
this.historyStatus = LoadingStatus.error;
}); });
this.history = {
[`${payload.pair}__${payload.timeframe}`]: {
pair: payload.pair,
timeframe: payload.timeframe,
timerange: payload.timerange,
data: data,
},
};
this.historyStatus = LoadingStatus.success;
} catch (err) {
console.error(err);
this.historyStatus = LoadingStatus.error;
if (axios.isAxiosError(err)) {
console.error(err.response);
const errMsg = err.response?.data?.detail ?? 'Error fetching history';
showAlert(errMsg, 'danger');
}
return new Promise((resolve, reject) => {
reject(err);
});
}
} }
// Error branchs // Error branchs
const error = 'pair or timeframe or timerange not specified'; const error = 'pair or timeframe or timerange not specified';