From 2a38a16f6b198bb02fe8caf9550a8f31717d7dfc Mon Sep 17 00:00:00 2001 From: Hey <18427051+Hey@users.noreply.github.com> Date: Sun, 4 Feb 2024 11:56:00 +0100 Subject: [PATCH] Feature/Improve error logs for timeout in data provider services (#2953) * Improve error logs for timeout in data provider services * Update changelog --------- Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> --- CHANGELOG.md | 6 ++++++ .../services/data-provider/coingecko/coingecko.service.ts | 6 +++--- .../eod-historical-data/eod-historical-data.service.ts | 4 ++-- .../financial-modeling-prep.service.ts | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 101907ba..f1b64fd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Improved the error logs for a timeout in the data provider services + ## 2.47.0 - 2024-02-02 ### Changed diff --git a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts index bf69dbdc..6c6d73a8 100644 --- a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts +++ b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts @@ -80,7 +80,7 @@ export class CoinGeckoService implements DataProviderInterface { let message = error; if (error?.code === 'ABORT_ERR') { - message = `RequestError: The operation was aborted because the request to the data provider took more than ${this.configurationService.get( + message = `RequestError: The operation to get the asset profile for ${aSymbol} was aborted because the request to the data provider took more than ${this.configurationService.get( 'REQUEST_TIMEOUT' )}ms`; } @@ -195,7 +195,7 @@ export class CoinGeckoService implements DataProviderInterface { let message = error; if (error?.code === 'ABORT_ERR') { - message = `RequestError: The operation was aborted because the request to the data provider took more than ${this.configurationService.get( + message = `RequestError: The operation to get the quotes was aborted because the request to the data provider took more than ${this.configurationService.get( 'REQUEST_TIMEOUT' )}ms`; } @@ -242,7 +242,7 @@ export class CoinGeckoService implements DataProviderInterface { let message = error; if (error?.code === 'ABORT_ERR') { - message = `RequestError: The operation was aborted because the request to the data provider took more than ${this.configurationService.get( + message = `RequestError: The operation to search for ${query} was aborted because the request to the data provider took more than ${this.configurationService.get( 'REQUEST_TIMEOUT' )}ms`; } diff --git a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts index bcff104c..d9ee298b 100644 --- a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts +++ b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts @@ -271,7 +271,7 @@ export class EodHistoricalDataService implements DataProviderInterface { let message = error; if (error?.code === 'ABORT_ERR') { - message = `RequestError: The operation was aborted because the request to the data provider took more than ${this.configurationService.get( + message = `RequestError: The operation to get the quotes was aborted because the request to the data provider took more than ${this.configurationService.get( 'REQUEST_TIMEOUT' )}ms`; } @@ -423,7 +423,7 @@ export class EodHistoricalDataService implements DataProviderInterface { let message = error; if (error?.code === 'ABORT_ERR') { - message = `RequestError: The operation was aborted because the request to the data provider took more than ${this.configurationService.get( + message = `RequestError: The operation to search for ${aQuery} was aborted because the request to the data provider took more than ${this.configurationService.get( 'REQUEST_TIMEOUT' )}ms`; } diff --git a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts index b2290755..81cb96e9 100644 --- a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts +++ b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts @@ -143,7 +143,7 @@ export class FinancialModelingPrepService implements DataProviderInterface { let message = error; if (error?.code === 'ABORT_ERR') { - message = `RequestError: The operation was aborted because the request to the data provider took more than ${this.configurationService.get( + message = `RequestError: The operation to get the quotes was aborted because the request to the data provider took more than ${this.configurationService.get( 'REQUEST_TIMEOUT' )}ms`; } @@ -192,7 +192,7 @@ export class FinancialModelingPrepService implements DataProviderInterface { let message = error; if (error?.code === 'ABORT_ERR') { - message = `RequestError: The operation was aborted because the request to the data provider took more than ${this.configurationService.get( + message = `RequestError: The operation to search for ${query} was aborted because the request to the data provider took more than ${this.configurationService.get( 'REQUEST_TIMEOUT' )}ms`; }