refactor: streamline env var error messages and general cleanup

This commit is contained in:
xtrullor73
2024-05-25 00:44:47 -07:00
parent 7f3dd2c93a
commit 8d1a27285f
2 changed files with 4 additions and 6 deletions

View File

@@ -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.');
}
}

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