ForstaError

public final class ForstaError : CustomStringConvertible, Error

All errors thrown by LibForstaSwift are ForstaError objects. (adapted from the LibSignalProtocolSwift error class)

  • The error type

    Declaration

    Swift

    public let type: ErrorType
  • A decribing message accompaning the error

    Declaration

    Swift

    public let message: String?
  • If the error occured in a subfunction, then this variable can be used to construct an error trace.

    Declaration

    Swift

    public let cause: ForstaError?
  • The function were the error occured

    Declaration

    Swift

    public let function: String
  • The file that the error occured in

    Declaration

    Swift

    public let file: String
  • Create a new ForstaError.

    Declaration

    Swift

    public init(_ type: ErrorType,
         _ message: String? = nil,
         cause: ForstaError? = nil,
         file: String = #file,
         function: String = #function)

    Parameters

    type

    The error type

    message

    A decription of why the error occured

    cause

    Optional error thrown by a subroutine

    file

    A String describing the file where the error occured

    function

    A String describing the function where the error occured

  • Create a new ForstaError using an already exisiting ForstaError from a subroutine.

    Declaration

    Swift

    public init(_ message: String,
         cause: ForstaError,
         file: String = #file,
         function: String = #function)

    Parameters

    message

    A decription of why the error occured

    cause

    The error thrown by the subroutine

    file

    A String describing the file where the error occured

    function

    A String describing the function where the error occured

  • Create a specific ForstaError with an Error as the annotating explanation.

    Declaration

    Swift

    public convenience init(_ type: ErrorType,
         cause: Error,
         file: String = #file,
         function: String = #function)

    Parameters

    type

    The error type

    cause

    The error thrown by the subroutine

    file

    A String describing the file where the error occured

    function

    A String describing the function where the error occured

  • Create a specific ForstaError with JSON giving details.

    Declaration

    Swift

    public convenience init(_ type: ErrorType,
                            _ message: JSON,
                            file: String = #file,
                            function: String = #function)

    Parameters

    type

    The error type

    message

    The JSON details

    file

    A String describing the file where the error occured

    function

    A String describing the function where the error occured

  • Create a new ForstaError using an already exisiting Error from a subroutine.

    Declaration

    Swift

    public convenience init(_ message: String,
                            cause: Error,
                            file: String = #file,
                            function: String = #function)

    Parameters

    message

    A decription of why the error occured

    cause

    The error thrown by the subroutine

    file

    A String describing the file where the error occured

    function

    A String describing the function where the error occured

  • A decription of the error, including all contained errors, without function and file names

    Declaration

    Swift

    public var description: String { get }
  • A short decription of the error without the contained errors

    Declaration

    Swift

    public var shortDescription: String { get }
  • A decription of the error, including all contained errors, as well as function and file names

    Declaration

    Swift

    public var longDescription: String { get }
  • The description of the error

    Declaration

    Swift

    public var localizedDescription: String { get }
  • The error’s message converted to JSON (i.e., for .requestRejected), if possible

    Declaration

    Swift

    public var json: JSON { get }