The integrated platform for monitoring & security
Observability
End-to-end, simplified visibility into your stack’s health & performance
インフラ
Applications
ログ
セキュリティ
Detect, prioritize, and respond to threats in real-time
Cloud Security
Application Security
Cloud SIEM
Digital Experience
Optimize front-end performance and enhance user experiences
Related Products
Software Delivery
Build, test, secure and ship quality code faster
Service Management
Integrated, streamlined workflows for faster time-to-resolution
AIOps
AI
Monitor and improve model performance. Pinpoint root causes and detect anomalies
AI Observability
Platform Capabilities
Built-in features & integrations that power the Datadog platform
Built-in Features
Workflows & Collaboration
Extensibility
Industry
テクノロジー
Use-case
Looking for Datadog logos?
You can find the logo assets on our press page.
ID: python-best-practices/no-base-exception
python-best-practices/no-base-exception
Language: Python
Severity: Notice
Category: Best Practices
Do not raise Exception and BaseException. These are too generic. Having generic exceptions makes it difficult to differentiate errors in a program. Use a specific exception, for example, ValueError, or create your own instead of using generic ones.
Exception
BaseException
ValueError
raise Exception
if foo: raise Exception("bla") elif bar: raise Exception else: raise Exception
def use_base_exception(): raise Exception raise Exception("awesome")
for v in list: raise BaseException
if foo: print("bar") else: raise ValueError
Seamless integrations. Try Datadog Code Analysis
1 2
rulesets: - python-best-practices # Rules to enforce Python best practices.
For more information, please read the Code Analysis documentation
Identify code vulnerabilities directly in yourVS Code editor
Identify code vulnerabilities directly inJetBrains products