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
typeThe error type
messageA decription of why the error occured
causeOptional error thrown by a subroutine
fileA String describing the file where the error occured
functionA String describing the function where the error occured
-
Create a new
ForstaErrorusing an already exisitingForstaErrorfrom a subroutine.Declaration
Swift
public init(_ message: String, cause: ForstaError, file: String = #file, function: String = #function)Parameters
messageA decription of why the error occured
causeThe error thrown by the subroutine
fileA String describing the file where the error occured
functionA String describing the function where the error occured
-
Create a specific
ForstaErrorwith anErroras the annotating explanation.Declaration
Swift
public convenience init(_ type: ErrorType, cause: Error, file: String = #file, function: String = #function)Parameters
typeThe error type
causeThe error thrown by the subroutine
fileA String describing the file where the error occured
functionA String describing the function where the error occured
-
Create a specific
ForstaErrorwith JSON giving details.Declaration
Swift
public convenience init(_ type: ErrorType, _ message: JSON, file: String = #file, function: String = #function)Parameters
typeThe error type
messageThe JSON details
fileA String describing the file where the error occured
functionA String describing the function where the error occured
-
Create a new
ForstaErrorusing an already exisitingErrorfrom a subroutine.Declaration
Swift
public convenience init(_ message: String, cause: Error, file: String = #file, function: String = #function)Parameters
messageA decription of why the error occured
causeThe error thrown by the subroutine
fileA String describing the file where the error occured
functionA 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 }
-
The different types of errors that LibForstaSwift can throw.
See moreDeclaration
Swift
public enum ErrorType : String
View on GitHub
Install in Dash
ForstaError Class Reference