Skip to content

Commit

Permalink
move error closer to Result it takes part in
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldjeffrey committed Jun 6, 2024
1 parent 5d7bd20 commit 03dfe72
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions coverage_point_calculator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ pub mod speedtest;

pub type Result<T = ()> = std::result::Result<T, Error>;

#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("signal level {0:?} not allowed for {1:?}")]
InvalidSignalLevel(SignalLevel, RadioType),
}
/// Necessary checks for calculating coverage points is done during [RewardableRadio::new].
#[derive(Debug, Clone)]
pub struct RewardableRadio {
Expand Down Expand Up @@ -112,12 +117,6 @@ pub struct CoveragePoints {
pub boosted_hex_eligibility: BoostedHexStatus,
}

#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("signal level {0:?} not allowed for {1:?}")]
InvalidSignalLevel(SignalLevel, RadioType),
}

pub fn calculate_coverage_points(radio: RewardableRadio) -> CoveragePoints {
let hex_coverage_points = radio.covered_hexes.calculated_coverage_points();
let location_trust_multiplier = radio.location_trust_scores.multiplier;
Expand Down

0 comments on commit 03dfe72

Please sign in to comment.