Browse Source

Feature/improve error log for data source request timeout (#2688)

* Improve error log for timeouts

* Update changelog
pull/2692/head
Thomas Kaul 1 year ago
committed by GitHub
parent
commit
0a83bcd697
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 24
      apps/api/src/services/data-provider/coingecko/coingecko.service.ts
  3. 16
      apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts
  4. 16
      apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts
  5. 8
      apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts

1
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`

24
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 };

16
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;

16
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 };

8
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;
}

Loading…
Cancel
Save