From b99776716029b3064cf256a73d2d5d3769bca94e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Wed, 7 May 2014 09:13:24 +0000 Subject: [PATCH] give better exception; refs #30 --- src/cryptoki.hxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/cryptoki.hxx b/src/cryptoki.hxx index 5be367c..eebe401 100644 --- a/src/cryptoki.hxx +++ b/src/cryptoki.hxx @@ -1867,11 +1867,15 @@ namespace cryptoki { CK_USER_TYPE userType=CKU_USER): _session(session) { CRYPTOLOG("log"); //! calls @c C_Login - _session.check(_session._slot.library()->C_Login - (_session._session, userType, - const_cast((const CK_CHAR*)pin.c_str()), - (int)pin.size()), - CRYPTOKI_FN_LOG("C_Login")); + try { + _session.check(_session._slot.library()->C_Login + (_session._session, userType, + const_cast((const CK_CHAR*)pin.c_str()), + (int)pin.size()), + CRYPTOKI_FN_LOG("C_Login")); + } catch (std::exception& x) { + throw wrong_pin(x.what()); + } } ~Login() {