Exception: Ibex::LSP::ProtocolError
- Defined in:
- lib/ibex/lsp/protocol_error.rb
Overview
Bounded protocol and workspace failures with their JSON-RPC error code.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
: Integer.
-
#fatal ⇒ Object
readonly
: bool.
-
#request_id ⇒ Object
readonly
: String | Integer | nil.
Instance Method Summary collapse
-
#initialize(message, code: -32_600,, request_id: nil, fatal: false) ⇒ ProtocolError
constructor
A new instance of ProtocolError.
Constructor Details
#initialize(message, code: -32_600,, request_id: nil, fatal: false) ⇒ ProtocolError
Returns a new instance of ProtocolError.
22 23 24 25 26 27 28 29 30 |
# File 'lib/ibex/lsp/protocol_error.rb', line 22 def initialize(, code: -32_600, request_id: nil, fatal: false) normalized = .encode(Encoding::UTF_8, invalid: :replace, undef: :replace) bounded = normalized[0, Limits::MAX_ERROR_MESSAGE_CHARACTERS] || "" bounded += "…" if bounded.length < normalized.length super("(lsp):1:1: #{bounded}") @code = code @request_id = request_id @fatal = fatal end |
Instance Attribute Details
#code ⇒ Object (readonly)
: Integer
17 18 19 |
# File 'lib/ibex/lsp/protocol_error.rb', line 17 def code @code end |
#fatal ⇒ Object (readonly)
: bool
19 20 21 |
# File 'lib/ibex/lsp/protocol_error.rb', line 19 def fatal @fatal end |
#request_id ⇒ Object (readonly)
: String | Integer | nil
18 19 20 |
# File 'lib/ibex/lsp/protocol_error.rb', line 18 def request_id @request_id end |