Skip to content

Commit

Permalink
More doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
juri committed May 10, 2024
1 parent 61f84c8 commit 4efa61e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/DotEnvy/DotEnvy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ public func formatError(source: String, error: ParseError, errorLocation: String
"""
}

/// Errors that occur during parsing.
///
/// `ParseError` does not include information about the error location. That information
/// can be derived from the location where the parsed substring was left at by ``parse(substring:)``.
///
/// - SeeAlso: If you call ``parse(string:)``, the thrown error is ``ParseErrorWithLocation`` which does
/// include the location information.
public enum ParseError: Error {
case invalidEscapeSequence
case invalidKeyStart(Character)
Expand All @@ -196,6 +203,7 @@ extension ParseError: CustomStringConvertible {
}
}

/// Encapsulates a ``ParseError`` along with location in the original input.
public struct ParseErrorWithLocation: Error {
public var error: ParseError
public var location: String.Index
Expand Down

0 comments on commit 4efa61e

Please sign in to comment.