ProcessingError

public enum ProcessingError : CausalErrorType

A useful standard implementation of TestErrorType that enables the reporting of most kinds of issues

  • A low level scanner error

    Declaration

    Swift

    case scannedMatchFailed
  • An internal error (perhaps an exception thrown compiling a regular expression) that can be wrapped to provide a TestError

    Declaration

    Swift

    case `internal`(cause: Error)
  • An error where no specific error message has been defined

    Declaration

    Swift

    case undefined(message: String, at: String.Index, causes: [Error])
  • An error during scanning, with a defined message

    Declaration

    Swift

    case scanning(message: String, position: String.Index, causes: [Error])
  • An error during parsing, with a defined message

    Declaration

    Swift

    case parsing(message: String, range: ClosedRange<String.Index>, causes: [Error])
  • An error during interpretation of parsed results, with a defined message

    Declaration

    Swift

    case interpretation(message: String, causes: [Error])
  • A fatal error that should stop parsing and cause exit to the top

    Declaration

    Swift

    case fatal(message: String, causes: [Error])
  • true if ProcessingError.fatal

    Declaration

    Swift

    public var isFatal: Bool { get }
  • Constructs a scanning or parsing error (depending on wether or not a TokenType is supplied) from the supplied data.

    Declaration

    Swift

    public init(with behaviour: Behaviour, and annotations: RuleAnnotations, whenUsing lexer: LexicalAnalyzer, causes errors: [Error]?)

    Parameters

    behaviour

    The behaviour of the rule that encountered the error

    annotations

    Annotations on the rule that encountered the error

    lexer

    The lexical analyzer being used for scanning

    errors

    That were generated by any contained tests

  • The errors that caused this error, or nil if this is the root error

    Declaration

    Swift

    public var causedBy: [Error]? { get }
  • The range in the source string that caused this error, or nil (for example an internal error)

    Declaration

    Swift

    public var range: ClosedRange<String.Index>? { get }
  • A human readable version of the error message. It does not include any causes except for internal error (where the cause really is the error being reported)

    Declaration

    Swift

    public var message: String { get }
  • A textual description of the error and its causes

    Declaration

    Swift

    public var description: String { get }
  • Filters the error and its caueses by the using the supplied block. Note that internal errors with no matching cause will also be filtered out.

    Declaration

    Swift

    public func filtered(include: (Error) -> Bool) -> ProcessingError?

    Parameters

    include

    A closure that should return true if the supplied error should be included in the filtered result

    Return Value

    A filtered version of the error or nil if the error itself does not match the filter

  • Filters this error and all of its causes including only those that are of the types provided

    Declaration

    Swift

    public func filtered(including includedTypes: ProcessingErrorType) -> ProcessingError?

    Parameters

    includedTypes

    The types that should be included after filtering

  • Filters this error and all of its causes including only those that have messages matching the supplied regular expression pattern.

    Declaration

    Swift

    public func filtered(includingMessagesMatching pattern: String) -> ProcessingError?

    Parameters

    pattern

    A regular expression to use to check messages from teh errors

    Return Value

    nil if no errors match, or a new error with just matching children and their parents

  • The type of the error

    Declaration

    Swift

    public var processingErrorType: ProcessingErrorType { get }