Exception: Smartcard::PCSC::Exception

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/smartcard/pcsc/exception.rb

Overview

Contains information about an exception at the PC/SC layer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_status) ⇒ Exception

Returns a new instance of Exception.



3
4
5
6
7
8
# File 'lib/smartcard/pcsc/exception.rb', line 3

def initialize(error_status)
  @pcsc_status_code = 2**32 + error_status
  @pcsc_status = Smartcard::PCSC::FFILib::Status.find @pcsc_status_code
  
  super "#{@pcsc_status} (0x#{@pcsc_status_code.to_s(16)})"
end

Instance Attribute Details

#pcsc_statusObject (readonly)

Symbol for the PC/SC error status that caused this error.



11
12
13
# File 'lib/smartcard/pcsc/exception.rb', line 11

def pcsc_status
  @pcsc_status
end

#pcsc_status_codeObject (readonly)

The PC/SC error status that caused this error, as a number.



14
15
16
# File 'lib/smartcard/pcsc/exception.rb', line 14

def pcsc_status_code
  @pcsc_status_code
end