InsionInsion
Ruby

Errors

Handle Ruby API, timeout, and transport failures

Overview

This guide explains how to handle errors returned by the Insion SDK and inspect response details when troubleshooting failed requests.

Handle errors

All failures inherit from Insion::Errors::ApiError. Rescue narrower types when behavior differs by failure.

begin
  client.moderate_a_record(
    client_id: "post-123", name: "A post", entity: "post", content: "Hello"
  )
rescue Insion::Errors::TimeoutError => error
  warn error.message
rescue Insion::Errors::ServiceUnavailableError => error
  warn error.message
rescue Insion::Errors::ResponseError => error
  warn "#{error.code}: #{error.message}"
rescue Insion::Errors::ApiError => error
  warn error.message
end

Error types

ResponseError represents unexpected HTTP statuses; subclasses cover common failures such as service unavailability. Network and serialization failures remain typed SDK errors.

How is this guide?

On this page

Latest Release

View the Ruby SDK on RubyGemsRuby SDK versionRuby SDK license