error.rs
This file
Path
src/error.rs
64 lines · 2.6 KiB · Rust
Last changed by
Merge pull request #951 from Likio3000/codex/reject-negative-parameter-stepsDavid Peterbefore adoption862625f
History of this fileTake it
The walk stopped after 200 commits: lines older than c44aa1d point at it.
Fix clippy suggestionsDavid Peterbefore adoptionc44aa1d
lines 1–6why, one step back1use std::num::{self, ParseFloatError, ParseIntError};23use rust_decimal::Error as DecimalError;4use thiserror::Error;56#[derive(Debug, Error)]Handle broken pipe errors on stdout gracefully (#932)jkbefore adoptionc0b3834
lines 7–10why, one step back7#[error(transparent)]8pub struct ConsoleOutputError(pub std::io::Error);910#[derive(Debug, Error)]Fix clippy suggestionsDavid Peterbefore adoptionc44aa1d
lines 11–21why, one step back11pub enum ParameterScanError {12 #[error("Error while parsing parameter scan arguments ({0})")]13 ParseIntError(num::ParseIntError),14 #[error("Error while parsing parameter scan arguments ({0})")]15 ParseDecimalError(DecimalError),16 #[error("Empty parameter range")]17 EmptyRange,18 #[error("Parameter range is too large")]19 TooLarge,20 #[error("Zero is not a valid parameter step")]21 ZeroStep,Merge pull request #951 from Likio3000/codex/reject-negative-parameter-stepsDavid Peterbefore adoption862625f
lines 22–23why, one step back22 #[error("Parameter step size must be positive")]23 NegativeStep,Fix clippy suggestionsDavid Peterbefore adoptionc44aa1d
lines 24–64why, one step back24 #[error("A step size is required when the range bounds are floating point numbers. The step size can be specified with the '-D/--parameter-step-size <DELTA>' parameter")]25 StepRequired,26 #[error("'--command-name' has been specified {0} times. It has to appear exactly once, or exactly {1} times (number of benchmarks)")]27 UnexpectedCommandNameCount(usize, usize),28}2930impl From<num::ParseIntError> for ParameterScanError {31 fn from(e: num::ParseIntError) -> ParameterScanError {32 ParameterScanError::ParseIntError(e)33 }34}3536impl From<DecimalError> for ParameterScanError {37 fn from(e: DecimalError) -> ParameterScanError {38 ParameterScanError::ParseDecimalError(e)39 }40}4142#[derive(Debug, Error)]43pub enum OptionsError<'a> {44 #[error(45 "Conflicting requirements for the number of runs (empty range, min is larger than max)"46 )]47 EmptyRunsRange,48 #[error("Too many --command-name options: Expected {0} at most")]49 TooManyCommandNames(usize),50 #[error("'--command-name' has been specified {0} times. It has to appear exactly once, or exactly {1} times (number of benchmarks)")]51 UnexpectedCommandNameCount(usize, usize),52 #[error("Could not read numeric integer argument to '--{0}': {1}")]53 IntParsingError(&'a str, ParseIntError),54 #[error("Could not read numeric floating point argument to '--{0}': {1}")]55 FloatParsingError(&'a str, ParseFloatError),56 #[error("An empty command has been specified for the '--shell <command>' option")]57 EmptyShell,58 #[error("Failed to parse '--shell <command>' expression as command line: {0}")]59 ShellParseError(shell_words::ParseError),60 #[error("Unknown output policy '{0}'. Use './{0}' to output to a file named '{0}'.")]61 UnknownOutputPolicy(String),62 #[error("The file '{0}' specified as '--input' does not exist")]63 StdinDataFileDoesNotExist(String),64}