public LedgerWalletException(string message, LedgerWalletStatus sw)
     : base(message)
 {
     if(sw == null)
         throw new ArgumentNullException("sw");
     _Status = sw;
 }
Exemple #2
0
 public LedgerWalletException(string message, LedgerWalletStatus sw)
     : base(message)
 {
     if (sw == null)
     {
         throw new ArgumentNullException("sw");
     }
     _Status = sw;
 }
        protected virtual string GetErrorMessage(LedgerWalletStatus status)
        {
            switch (status.SW)
            {
            case 0x6D00:
                return("INS not supported");

            case 0x6E00:
                return("CLA not supported");

            case 0x6700:
                return("Incorrect length");

            case 0x6982:
                return("Command not allowed : Security status not satisfied");

            case 0x6985:
                return("Command not allowed : Conditions of use not satisfied");

            case 0x6A80:
                return("Invalid data");

            case 0x6482:
                return("File not found");

            case 0x6B00:
                return("Incorrect parameter P1 or P2");

            case 0x9000:
                return("OK");

            default:
            {
                if ((status.SW & 0xFF00) != 0x6F00)
                {
                    return("Unknown error");
                }
                switch (status.InternalSW)
                {
                case 0xAA:
                    return("The dongle must be reinserted");

                default:
                    return("Unknown error");
                }
            }
            }
        }
 protected void Throw(int sw)
 {
     var status = new LedgerWalletStatus(sw);
     throw new LedgerWalletException(GetErrorMessage(status), status);
 }
 protected virtual string GetErrorMessage(LedgerWalletStatus status)
 {
     switch(status.SW)
     {
         case 0x6700:
             return "Incorrect length";
         case 0x6982:
             return "Command not allowed : Security status not satisfied";
         case 0x6985:
             return "Command not allowed : Conditions of use not satisfied";
         case 0x6A80:
             return "Invalid data";
         case 0x6482:
             return "File not found";
         case 0x6B00:
             return "Incorrect parameter P1 or P2";
         case 0x9000:
             return "OK";
         case 0x6D00:
             return "Insupported command";
         default:
             {
                 if((status.SW & 0xFF00) != 0x6F00)
                     return "Unknown error";
                 switch(status.InternalSW)
                 {
                     case 0xAA:
                         return "The dongle must be reinserted";
                     default:
                         return "Unknown error";
                 }
             }
     }
 }
        protected void Throw(int sw)
        {
            var status = new LedgerWalletStatus(sw);

            throw new LedgerWalletException(GetErrorMessage(status), status);
        }
 public LedgerWalletException(string message, LedgerWalletStatus sw)
     : base(message)
 {
     Status = sw ?? throw new ArgumentNullException("sw");
 }