Improve API validation error messages with helpful instructions instead of traceback
This commit is contained in:
+11
-5
@@ -1356,10 +1356,16 @@ def main():
|
|||||||
logger.info(f"✅ Clock access verified - Market is {'OPEN' if clock.is_open else 'CLOSED'}")
|
logger.info(f"✅ Clock access verified - Market is {'OPEN' if clock.is_open else 'CLOSED'}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"❌ API validation failed: {e}")
|
error_msg = str(e).lower()
|
||||||
logger.error(" Please check your API credentials in .env file")
|
logger.error(f"❌ API validation failed")
|
||||||
import traceback
|
|
||||||
logger.error(traceback.format_exc())
|
if 'unauthorized' in error_msg or 'forbidden' in error_msg:
|
||||||
|
logger.error(f"🔑 Invalid API credentials detected")
|
||||||
|
logger.error(f"Please update your .env file with valid API keys")
|
||||||
|
else:
|
||||||
|
logger.error(f"Error: {e}")
|
||||||
|
logger.error(f"Please check your .env file and network connection")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# Run backtest once at startup
|
# Run backtest once at startup
|
||||||
@@ -1625,4 +1631,4 @@ def main():
|
|||||||
logger.info("🔚 Shutdown")
|
logger.info("🔚 Shutdown")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user