Skip to content

Commit 65341db

Browse files
committed
Add a bit to README about error formatting
1 parent f4aebbb commit 65341db

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,27 @@ KEY5=unquoted value referring to ${KEY4}
2525
KEY6="multiline
2626
string"
2727
```
28+
29+
## Error reporting
30+
31+
DotEnvy has helpful error reporting on syntax errors.
32+
33+
```swift
34+
do {
35+
try parse(string: #"""
36+
KEY="VALUE
37+
"""#)
38+
} catch let error as ParseErrorWithLocation {
39+
let formatted = formatError(source: source, error: error)
40+
print(formatted)
41+
}
42+
```
43+
44+
outputs
45+
46+
```
47+
1: KEY="VALUE
48+
^
49+
50+
Error on line 1: Unterminated quote
51+
```

0 commit comments

Comments
 (0)