NSError

public extension NSError
  • Initializes a new NSError and injects the specified description into the userInfo dictionary

    Declaration

    Swift

    convenience init(domain: String = "com.henrikpanhans.CLIFoundation", code: Int = 1, description: String)

    Parameters

    domain

    The error domain

    code

    The code of the occured error

    description

    A textual description of the occured error

  • Formats the localizedDescription property to be displayed in a terminal

    Declaration

    Swift

    func makeTerminalFormatted(boldText: Bool = false) -> String

    Parameters

    boldText

    Indicates whether or not the text should be displayed in bold or not

    Return Value

    A terminal formatted String

  • Formats and prints the localizedDescription property and exits with the associated error code

    Declaration

    Swift

    func printAndExit(boldText: Bool = false) -> Never

    Parameters

    boldText

    Indicates whether or not the text should be displayed in bold or not