Listing of subclassed validation related exceptions is misleading

オープン 初心者向け
#22 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
65/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
documentation

調査の方向性

例外リストは、validate.validate_usage と validate.validate_tls の参照されている行付近にある docs/api.md にあります。そのセクションと例外の定義を読んでサブクラスの関係を確認し、それらを説明するとともに、PathValidationError の前に具体的なサブクラスを列挙するようドキュメントを更新してください。

索引モデルが issue の本文から書いたものです。

説明

The API documentation of validate.validate_usage and validate.validate_tls lists the following exceptions:

https://github.com/wbond/certvalidator/blob/5bc5c390c1955195507c23db91b8926bb03f7385/docs/api.md#L91-L94

When someone tries to catch and distinguish those exceptions, its important to know that both RevokedError and InvalidCertificateError are subclass of PathValidationError. If exceptions are attempted to be caught in the order the API documentation lists them, RevokedError and InvalidCertificateError will never be caught:

try:
    validation_path = validator.validate_usage(key_usage)
except PathValidationError as ex:
    # handle PathValidationError
    # This will catch RevokedError and InvalidCertificateError too!
    pass
except RevokedError as ex:
    # control is never passed here!
    pass
except InvalidCertificateError as ex:
    # control is never passed here!
    pass

On the other hand those exceptions can be properly handled if PathValidationError is the last to be caught:

try:
    validation_path = validator.validate_usage(key_usage)
except RevokedError as ex:
    # handle RevokedError
    pass
except InvalidCertificateError as ex:
    # handle InvalidCertificateError
    pass
except PathValidationError as ex:
    # handle PathValidationError
    pass

I suggest to modify the API documentation to clarify subclassing of those exceptions and list them in a more appropriate order.

主要言語
Python
スター
117
フォーク
37
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

wbond/certvalidator のほかの issue

wbond/certvalidator の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。