Exception: Ibex::LSP::ProtocolError
- Defined in:
- lib/ibex/lsp/protocol_error.rb,
sig/ibex/lsp/protocol_error.rbs
Overview
Bounded protocol and workspace failures with their JSON-RPC error code.
Instance Attribute Summary collapse
- #code ⇒ Integer readonly
- #fatal ⇒ Boolean readonly
- #request_id ⇒ String, ... readonly
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 ⇒ Integer (readonly)
17 18 19 |
# File 'lib/ibex/lsp/protocol_error.rb', line 17 def code @code end |
#fatal ⇒ Boolean (readonly)
19 20 21 |
# File 'lib/ibex/lsp/protocol_error.rb', line 19 def fatal @fatal end |
#request_id ⇒ String, ... (readonly)
18 19 20 |
# File 'lib/ibex/lsp/protocol_error.rb', line 18 def request_id @request_id end |