History

Swift
public struct History

Holds the most recent errors thrown by RubyGateway.

This can be useful when the module indicates an error has occurred through a nil result somewhere – the error causing the nil has still been generated internally and is stashed here.

These nil results happen during type conversion to Swift, for example String.init(_:), and when using the RbObjectAccess.failable adapter that suppresses throwing.

Methods are thread-safe.


Topics

var errors: [RbError]

The error history.

The oldest error recorded is at index 0; the most recent is at the end of the array. See mostRecent.

The list is automatically pruned, there is no need to worry about this consuming all your memory.

Declaration
Swift
public private(set) var errors: [RbError] { get }

var mostRecent: RbError?

The most recent error encountered by RubyGateway.

Declaration
Swift
public var mostRecent: RbError? { get }

func clear()

Clear the error history.

Declaration
Swift
public mutating func clear()