Exception: StandardSingpass::Myinfo::Error
- Inherits:
-
StandardError
- Object
- StandardError
- StandardSingpass::Myinfo::Error
- Extended by:
- T::Sig
- Defined in:
- lib/standard_singpass/myinfo/error.rb
Overview
Base class for every error the gem raises.
Every error carries the two facts a host needs to decide what to tell the user, so neither has to be recovered by reading the message:
status — the HTTP status of the Singpass response that produced the
error. Nil when there was no response (a transport failure) and for
errors a host raises itself.
transport? — true when we never got an answer from Singpass at all
(DNS, connection refused, TLS, read timeout — a Faraday::Error under
the hood), as opposed to Singpass answering with something we can't
use. Only the former is unambiguously their side being unreachable.
Both live on the base class rather than on ApiError alone because
every leg of the flow raises its own class — PARError for PAR,
ApiError for token and userinfo — and a host asking "is Singpass
available?" needs the same answer from all of them. Scoping status to
ApiError would silently misclassify a 502 from the PAR endpoint as
"our request was wrong".
The alternative — matching "unreachable" or an HTTP code in message —
is a trap: the message is not a stable interface. FailureClassifier
consumes these so hosts never have to.
Direct Known Subclasses
ApiError, AuthenticationError, ConfigurationError, DecryptionError, PARError, RateLimitError, Security::DecryptionError, Security::ValidationError, SignatureError
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message = nil, status: nil, transport: false) ⇒ Error
constructor
A new instance of Error.
- #transport? ⇒ Boolean
Constructor Details
#initialize(message = nil, status: nil, transport: false) ⇒ Error
Returns a new instance of Error.
44 45 46 47 48 |
# File 'lib/standard_singpass/myinfo/error.rb', line 44 def initialize( = nil, status: nil, transport: false) super() @status = status @transport = transport end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
33 34 35 |
# File 'lib/standard_singpass/myinfo/error.rb', line 33 def status @status end |
Instance Method Details
#transport? ⇒ Boolean
51 52 53 |
# File 'lib/standard_singpass/myinfo/error.rb', line 51 def transport? @transport end |