The error_callback
is a parameter in the initialize
method of the Ruby SDK that is triggered with an error message if the network request to initialize the SDK fails. This can be used for basic error handling.
Here is an example of how to use the error_callback
:
ruby Statsig.initialize(api_key, { data_adapter: Statsig::InMemoryDataAdapter.new, error_callback: lambda { |error| puts "Error: #{error}" } })
In this example, if the SDK fails to initialize due to a network request failure, the error_callback
will be triggered and the error message will be printed to the console.
You can also refer to the test case that verifies this behavior in the Ruby SDK's GitHub repository here.
Please note that the documentation is being updated to include this information for future reference.