界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

nvidia-nemo-rl-error-handling

nvidia-nemo-rl-error-handling

【效率与协作】Error handling guidelines for NeMo-RL. Covers exception specificity, minimal try bodies, and else blocks.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: nvidia-nemo-rl-error-handling description: Error handling guidelines for NeMo-RL. Covers exception specificity, minimal try bodies, and else blocks. license: Apache-2.0 AND CC-BY-4.0 metadata: when_to_use: Writing or reviewing exception handling; 'try-except', 'catch all exceptions', 'bare except', 'how to handle errors', during code review. author: NVIDIA

Error Handling

Use Specific Exceptions

When using try-except blocks, limit the except to the smallest set of errors possible.

Don't:

try:
    open(path, "r").read()
except:
    print("Failed to open file")

Do:

try:
    open(path, "r").read()
except FileNotFoundError:
    print("Failed to open file")
我的收藏