Exception: Takagi::Errors::ObservableError

Inherits:
TakagiError
  • Object
show all
Defined in:
lib/takagi/errors.rb

Overview

Raised when observable/observer operations fail

Instance Attribute Summary

Attributes inherited from TakagiError

#context, #suggestions

Class Method Summary collapse

Methods inherited from TakagiError

#initialize

Constructor Details

This class inherits a constructor from Takagi::Errors::TakagiError

Class Method Details

.duplicate_observable(path) ⇒ Object



237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/takagi/errors.rb', line 237

def self.duplicate_observable(path)
  new(
    "Observable already registered: #{path}",
    context: {
      path: path
    },
    suggestions: [
      "Each path can only have one observable definition",
      "Use different paths for different data streams",
      "Or use EventBus.publish to send different events to same path"
    ]
  )
end

.invalid_uri(uri, reason) ⇒ Object



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/takagi/errors.rb', line 221

def self.invalid_uri(uri, reason)
  new(
    "Invalid CoAP URI: #{uri.inspect}",
    context: {
      uri: uri,
      reason: reason
    },
    suggestions: [
      "Use format: coap://host:port/path",
      "Example: coap://sensor:5683/temperature",
      "For UDP: coap://...",
      "For TCP: coap+tcp://..."
    ]
  )
end