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

View File

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