- String verificationCode = ns.getString("verificationCode");
- String pin = ns.getString("pin");
- m.verifyAccount(verificationCode, pin);
- return 0;
- } catch (LockedException e) {
- System.err.println("Verification failed! This number is locked with a pin. Hours remaining until reset: "
- + (e.getTimeRemaining() / 1000 / 60 / 60));
- System.err.println("Use '--pin PIN_CODE' to specify the registration lock PIN");
- return 3;
+ final var manager = m.verifyAccount(verificationCode, pin);
+ manager.close();
+ } catch (PinLockedException e) {
+ throw new UserErrorException(
+ "Verification failed! This number is locked with a pin. Hours remaining until reset: "
+ + (e.getTimeRemaining() / 1000 / 60 / 60)
+ + "\nUse '--pin PIN_CODE' to specify the registration lock PIN");
+ } catch (IncorrectPinException e) {
+ throw new UserErrorException("Verification failed! Invalid pin, tries remaining: " + e.getTriesRemaining());