Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,36 @@ quick_error!{
pub enum ParseError {
/// Error that may be returned when the string to parse contains invalid UTF-8 sequences
InvalidUtf8(line: usize, err: Utf8Error) {
display("bad unicode at line {}: {}", line, err)
display("bad unicode at line {}: {}", line + 1, err)
source(err)
}
/// Error returned a value for a given directive is invalid.
/// This can also happen when the value is missing, if the directive requires a value.
InvalidValue(line: usize) {
display("directive at line {} is improperly formatted \
or contains invalid value", line)
or contains invalid value", line + 1)
}
/// Error returned when a value for a given option is invalid.
/// This can also happen when the value is missing, if the option requires a value.
InvalidOptionValue(line: usize) {
display("directive options at line {} contains invalid \
value of some option", line)
value of some option", line + 1)
}
/// Error returned when a invalid option is found.
InvalidOption(line: usize) {
display("option at line {} is not recognized", line)
display("option at line {} is not recognized", line + 1)
}
/// Error returned when a invalid directive is found.
InvalidDirective(line: usize) {
display("directive at line {} is not recognized", line)
display("directive at line {} is not recognized", line + 1)
}
/// Error returned when a value cannot be parsed an an IP address.
InvalidIp(line: usize, err: AddrParseError) {
display("directive at line {} contains invalid IP: {}", line, err)
display("directive at line {} contains invalid IP: {}", line + 1, err)
}
/// Error returned when there is extra data at the end of a line.
ExtraData(line: usize) {
display("extra data at the end of the line {}", line)
display("extra data at the end of the line {}", line + 1)
}
}
}
Expand Down