Avoid catching InvalidPinError as ValueError.

This commit is contained in:
Dain Nilsson 2023-08-22 11:06:03 +02:00
parent 63d4c58cfe
commit 33eccbb53c
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
2 changed files with 4 additions and 2 deletions

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from yubikit.core import InvalidPinError
from functools import partial
import logging
@ -123,6 +124,8 @@ class RpcNode:
except ChildResetException as e:
self._close_child()
raise StateResetException(e.message, traversed)
except InvalidPinError:
raise # Prevent catching this as a ValueError below
except ValueError as e:
raise InvalidParametersException(e)
raise NoSuchActionException(action)

View File

@ -21,13 +21,12 @@ from .base import (
TimeoutException,
AuthRequiredException,
)
from yubikit.core import NotSupportedError, BadResponseError
from yubikit.core import NotSupportedError, BadResponseError, InvalidPinError
from yubikit.core.smartcard import ApduError, SW
from yubikit.piv import (
PivSession,
OBJECT_ID,
MANAGEMENT_KEY_TYPE,
InvalidPinError,
SLOT,
require_version,
KEY_TYPE,