Skip to content

Commit

Permalink
Add a bit to README about error formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
juri committed May 9, 2024
1 parent f4aebbb commit 65341db
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,27 @@ KEY5=unquoted value referring to ${KEY4}
KEY6="multiline
string"
```

## Error reporting

DotEnvy has helpful error reporting on syntax errors.

```swift
do {
try parse(string: #"""
KEY="VALUE
"""#)
} catch let error as ParseErrorWithLocation {
let formatted = formatError(source: source, error: error)
print(formatted)
}
```

outputs

```
1: KEY="VALUE
^
Error on line 1: Unterminated quote
```

0 comments on commit 65341db

Please sign in to comment.