Exception: Binance::SDK::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Binance::SDK::Error
- Defined in:
- lib/binance/sdk/error.rb
Direct Known Subclasses
BadAPIKeyFormat, BadInterval, BadPrecision, BadSymbol, CancelOrderRejected, CounterPartyBestPrice, Disconnected, EmptyNewCLOrderId, EmptyOrgCLOrderId, IllegalChars, IncorrectOrderPositionSide, IntervalTooLarge, InvalidCallbackRate, InvalidInterval, InvalidListenKey, InvalidOrderType, InvalidParameter, InvalidQuantity, InvalidSide, InvalidSignature, InvalidTIF, InvalidTimestamp, MandatoryParamEmptyOrMalformed, NewOrderRejected, NoDepth, NoNeedToChangeMarginType, NoSuchOrder, NoTradingWindow, OptionalParamsBadCombo, ParamEmpty, ParamNotRequired, QuantityGreaterThanMaxQuantity, RejectedAPIKey, ServiceShuttingDown, TIFNotRequired, Timeout, TimestampOutsideRecvWindow, TooManyOrders, TooManyParameters, TooManyRequests, Unauthorized, UnexpectedResponse, Unknown, UnknownOrderComposition, UnknownParam, UnreadParameters, UnsupportedOperation
Defined Under Namespace
Classes: BadAPIKeyFormat, BadInterval, BadPrecision, BadSymbol, CancelOrderRejected, CounterPartyBestPrice, Disconnected, EmptyNewCLOrderId, EmptyOrgCLOrderId, IllegalChars, IncorrectOrderPositionSide, IntervalTooLarge, InvalidCallbackRate, InvalidInterval, InvalidListenKey, InvalidOrderType, InvalidParameter, InvalidQuantity, InvalidSide, InvalidSignature, InvalidTIF, InvalidTimestamp, MandatoryParamEmptyOrMalformed, NewOrderRejected, NoDepth, NoNeedToChangeMarginType, NoSuchOrder, NoTradingWindow, OptionalParamsBadCombo, ParamEmpty, ParamNotRequired, QuantityGreaterThanMaxQuantity, RejectedAPIKey, ServiceShuttingDown, TIFNotRequired, Timeout, TimestampOutsideRecvWindow, TooManyOrders, TooManyParameters, TooManyRequests, Unauthorized, UnexpectedResponse, Unknown, UnknownOrderComposition, UnknownParam, UnreadParameters, UnsupportedOperation
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code: nil, json: {}, message: nil, symbol: nil) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ Object
- #message ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(code: nil, json: {}, message: nil, symbol: nil) ⇒ Error
Returns a new instance of Error.
67 68 69 70 71 |
# File 'lib/binance/sdk/error.rb', line 67 def initialize(code: nil, json: {}, message: nil, symbol: nil) @code = code || json[:code] @msg = || json[:message] @symbol = || json[:symbol] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/binance/sdk/error.rb', line 4 def code @code end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
4 5 6 |
# File 'lib/binance/sdk/error.rb', line 4 def msg @msg end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
4 5 6 |
# File 'lib/binance/sdk/error.rb', line 4 def symbol @symbol end |
Class Method Details
.is_error_response?(response:) ⇒ Boolean
7 8 9 |
# File 'lib/binance/sdk/error.rb', line 7 def is_error_response?(response:) response.code >= 400 end |
.localized(message) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/binance/sdk/error.rb', line 11 def localized() code = #.to_s.match(/\d+/).to_s.to_i case code when 1000 then Unknown when 1001 then Disconnected when 1002 then Unauthorized when 1003 then TooManyRequests when 1006 then UnexpectedResponse when 1007 then Timeout when 1013 then InvalidQuantity when 1014 then UnknownOrderComposition when 1015 then TooManyOrders when 1016 then ServiceShuttingDown when 1020 then UnsupportedOperation when 1021 then InvalidTimestamp when 1022 then InvalidSignature when 1100 then IllegalChars when 1101 then TooManyParameters when 1102 then MandatoryParamEmptyOrMalformed when 1103 then UnknownParam when 1104 then UnreadParameters when 1105 then ParamEmpty when 1106 then ParamNotRequired when 1111 then BadPrecision when 1112 then NoDepth when 1114 then TIFNotRequired when 1115 then InvalidTIF when 1116 then InvalidOrderType when 1117 then InvalidSide when 1118 then EmptyNewCLOrderId when 1119 then EmptyOrgCLOrderId when 1120 then BadInterval when 1121 then BadSymbol when 1125 then InvalidListenKey when 1127 then IntervalTooLarge when 1128 then OptionalParamsBadCombo when 1130 then InvalidParameter when 2007 then InvalidCallbackRate when 2010 then NewOrderRejected when 2011 then CancelOrderRejected when 2013 then NoSuchOrder when 2014 then BadAPIKeyFormat when 2015 then RejectedAPIKey when 2016 then NoTradingWindow when -1021 then TimestampOutsideRecvWindow when -4131 then CounterPartyBestPrice when -4005 then QuantityGreaterThanMaxQuantity when -1117 then InvalidSide when -4046 then NoNeedToChangeMarginType when -4061 then IncorrectOrderPositionSide when -1120 then InvalidInterval else Binance::SDK::Error end end |
Instance Method Details
#inspect ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/binance/sdk/error.rb', line 73 def inspect = "" += "(#{code}) " unless code.nil? += "@#{symbol} " unless symbol.nil? += "#{msg}" unless msg.nil? end |
#message ⇒ Object
81 82 83 |
# File 'lib/binance/sdk/error.rb', line 81 def inspect end |
#to_s ⇒ Object
85 86 87 |
# File 'lib/binance/sdk/error.rb', line 85 def to_s inspect end |