diff --git a/CHANGELOG.md b/CHANGELOG.md index cfa6874da..8ff90f055 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Improved the error log for a timeout in the data source request - Improved the language localization for German (`de`) - Upgraded `angular` from version `16.2.12` to `17.0.4` - Upgraded `Nx` from version `17.0.2` to `17.1.3` 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 6ed67bf8b..a9eb44405 100644 --- a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts +++ b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts @@ -56,7 +56,13 @@ export class CoinGeckoService implements DataProviderInterface { response.name = name; } catch (error) { - Logger.error(error, 'CoinGeckoService'); + let message = error; + + if (error?.code === 'ABORT_ERR') { + message = `RequestError: The operation was aborted because the request to the data provider took more than ${DEFAULT_REQUEST_TIMEOUT}ms`; + } + + Logger.error(message, 'CoinGeckoService'); } return response; @@ -174,7 +180,13 @@ export class CoinGeckoService implements DataProviderInterface { }; } } catch (error) { - Logger.error(error, 'CoinGeckoService'); + let message = error; + + if (error?.code === 'ABORT_ERR') { + message = `RequestError: The operation was aborted because the request to the data provider took more than ${DEFAULT_REQUEST_TIMEOUT}ms`; + } + + Logger.error(message, 'CoinGeckoService'); } return response; @@ -216,7 +228,13 @@ export class CoinGeckoService implements DataProviderInterface { }; }); } catch (error) { - Logger.error(error, 'CoinGeckoService'); + let message = error; + + if (error?.code === 'ABORT_ERR') { + message = `RequestError: The operation was aborted because the request to the data provider took more than ${DEFAULT_REQUEST_TIMEOUT}ms`; + } + + Logger.error(message, 'CoinGeckoService'); } return { items }; 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 a582a953d..448d54b25 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 @@ -229,7 +229,13 @@ export class EodHistoricalDataService implements DataProviderInterface { return response; } catch (error) { - Logger.error(error, 'EodHistoricalDataService'); + let message = error; + + if (error?.code === 'ABORT_ERR') { + message = `RequestError: The operation was aborted because the request to the data provider took more than ${DEFAULT_REQUEST_TIMEOUT}ms`; + } + + Logger.error(message, 'EodHistoricalDataService'); } return {}; @@ -382,7 +388,13 @@ export class EodHistoricalDataService implements DataProviderInterface { } ); } catch (error) { - Logger.error(error, 'EodHistoricalDataService'); + let message = error; + + if (error?.code === 'ABORT_ERR') { + message = `RequestError: The operation was aborted because the request to the data provider took more than ${DEFAULT_REQUEST_TIMEOUT}ms`; + } + + Logger.error(message, 'EodHistoricalDataService'); } return searchResult; 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 8c27f01a6..1c3db1520 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 @@ -151,7 +151,13 @@ export class FinancialModelingPrepService implements DataProviderInterface { }; } } catch (error) { - Logger.error(error, 'FinancialModelingPrepService'); + let message = error; + + if (error?.code === 'ABORT_ERR') { + message = `RequestError: The operation was aborted because the request to the data provider took more than ${DEFAULT_REQUEST_TIMEOUT}ms`; + } + + Logger.error(message, 'FinancialModelingPrepService'); } return response; @@ -196,7 +202,13 @@ export class FinancialModelingPrepService implements DataProviderInterface { }; }); } catch (error) { - Logger.error(error, 'FinancialModelingPrepService'); + let message = error; + + if (error?.code === 'ABORT_ERR') { + message = `RequestError: The operation was aborted because the request to the data provider took more than ${DEFAULT_REQUEST_TIMEOUT}ms`; + } + + Logger.error(message, 'FinancialModelingPrepService'); } return { items }; diff --git a/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts index 5e833cbf1..5c2df222c 100644 --- a/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts +++ b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts @@ -163,7 +163,13 @@ export class RapidApiService implements DataProviderInterface { return fgi; } catch (error) { - Logger.error(error, 'RapidApiService'); + let message = error; + + if (error?.code === 'ABORT_ERR') { + message = `RequestError: The operation was aborted because the request to the data provider took more than ${DEFAULT_REQUEST_TIMEOUT}ms`; + } + + Logger.error(message, 'RapidApiService'); return undefined; }