Exception: Phone::Pbx::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
app/services/phone/pbx.rb

Overview

Raised internally (and reported to AppSignal via ErrorReporting) when a
Switchvox request fails — non-2xx HTTP, malformed JSON, connection/timeout,
or a Switchvox-side error object in the JSON body. Callers still get a
PbxResponse(success: false, …) back, but the exception is surfaced as an
AppSignal incident so we don't silently lose a Switchvox-side outage again
(see 2026-06-09: ACL allowlist mismatch returned 403 forbidden.html for ~24h
while every dashboard looked green).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_method:, http_status: nil, body_snippet: nil, cause_message: nil) ⇒ ApiError

Returns a new instance of ApiError.



26
27
28
29
30
31
32
33
34
# File 'app/services/phone/pbx.rb', line 26

def initialize(api_method:, http_status: nil, body_snippet: nil, cause_message: nil)
  @api_method = api_method
  @http_status = http_status
  @body_snippet = body_snippet
  parts = ["pbx:#{api_method}"]
  parts << "http=#{http_status}" if http_status
  parts << cause_message if cause_message
  super(parts.join(' '))
end

Instance Attribute Details

#api_methodObject (readonly)

Returns the value of attribute api_method.



24
25
26
# File 'app/services/phone/pbx.rb', line 24

def api_method
  @api_method
end

#body_snippetObject (readonly)

Returns the value of attribute body_snippet.



24
25
26
# File 'app/services/phone/pbx.rb', line 24

def body_snippet
  @body_snippet
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



24
25
26
# File 'app/services/phone/pbx.rb', line 24

def http_status
  @http_status
end