Skip to content

Commit

Permalink
Improve parser error messages
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Young <[email protected]>
  • Loading branch information
seanyoung committed Mar 29, 2024
1 parent 13c4638 commit 64ee4e3
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/lircd_conf/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,15 +593,21 @@ impl<'a> LircParser<'a> {
}

if remote.gap == 0 {
warn!("{}:{}: missing gap", self.path.display(), self.line_no);
warn!(
"{}:{}: missing gap for remote {}",
self.path.display(),
self.line_no,
remote.name
);
}

if remote.duty_cycle > 99 {
warn!(
"{}:{}: duty_cycle {} is not valid",
"{}:{}: duty_cycle {} is not valid for remote {}",
self.path.display(),
self.line_no,
remote.duty_cycle
remote.duty_cycle,
remote.name
);
remote.duty_cycle = 0;
}
Expand All @@ -611,9 +617,10 @@ impl<'a> LircParser<'a> {

if !remote.codes.is_empty() {
error!(
"{}:{}: non-raw codes specified for raw remote",
"{}:{}: non-raw codes specified for raw remote {}",
self.path.display(),
self.line_no,
remote.name
);
return false;
}
Expand All @@ -623,15 +630,21 @@ impl<'a> LircParser<'a> {

if remote.flags.contains(Flags::RAW_CODES) {
error!(
"{}:{}: missing raw codes",
"{}:{}: missing raw codes for remote {}",
self.path.display(),
self.line_no,
remote.name
);
return false;
}

if remote.codes.is_empty() {
error!("{}:{}: missing codes", self.path.display(), self.line_no);
error!(
"{}:{}: missing codes for remote {}",
self.path.display(),
self.line_no,
remote.name
);
return false;
}

Expand Down

0 comments on commit 64ee4e3

Please sign in to comment.