Skip to content

Commit c7e0f7d

Browse files
committed
refactor: update reading arguments
1 parent 82c01f6 commit c7e0f7d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

cvmassistants/quote-generator/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use std::array::TryFromSliceError;
44

55
#[derive(Error, Debug)]
66
pub enum QuoteGeneratorError {
7-
#[error("Invalid usage: expected exactly 1 argument (report data)")]
8-
InvalidUsage,
7+
#[error("Invalid usage: expected exactly 1 argument (report data), received {actual}")]
8+
InvalidUsage { actual: usize },
99

1010
#[error("Report data must be at most {max} bytes, got {actual} bytes")]
1111
ReportDataTooLarge { max: usize, actual: usize },

cvmassistants/quote-generator/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ fn main() -> Result<(), QuoteGeneratorError> {
132132

133133
let args: Vec<String> = env::args().collect();
134134
if args.len() != 2 {
135-
error!("Usage: {} <{}-byte-report-data>", args[0], REPORT_DATA_SIZE);
136-
process::exit(1);
135+
return Err(QuoteGeneratorError::InvalidUsage { actual: args.len() });
137136
}
138137

139138
let input = &args[1];

0 commit comments

Comments
 (0)