mirror of
https://github.com/xtrll/MusicMetaFinder.git
synced 2026-04-25 10:16:01 +02:00
refactor: streamline env var error messages and general cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
export default function checkEnvVariables() {
|
||||
if (!process.env.ACOUSTID_API_KEY || !process.env.SPOTIFY_CLIENT_ID || !process.env.SPOTIFY_CLIENT_SECRET) {
|
||||
throw new Error('Please set up ACOUSTID_API_KEY, SPOTIFY_CLIENT_ID, and SPOTIFY_CLIENT_SECRET in your .env file.');
|
||||
if (!process.env.ACOUSTID_API_KEY) {
|
||||
throw new Error('Please set up ACOUSTID_API_KEY in your .env file.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,9 @@ const axiosInstance = axios.create();
|
||||
|
||||
axiosRetry(axiosInstance, {
|
||||
retries: 3, // The number of times to retry before failing
|
||||
retryCondition: (error) =>
|
||||
// Retry on a 429 status code or a 5xx status code
|
||||
retryCondition: (error) => // Retry on a 429 status code or a 5xx status code
|
||||
error.response.status === 429 || error.response.status >= 500,
|
||||
retryDelay: (retryCount) => retryCount * 2000 // Wait 2 seconds between retries
|
||||
,
|
||||
retryDelay: (retryCount) => retryCount * 2000, // Wait 2 seconds between retries
|
||||
});
|
||||
|
||||
export default axiosInstance;
|
||||
|
||||
Reference in New Issue
Block a user