• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tari-project / tari / 16123384529

07 Jul 2025 05:11PM UTC coverage: 64.327% (-7.6%) from 71.89%
16123384529

push

github

web-flow
chore: new release v4.9.0-pre.0 (#7289)

Description
---
new release esmeralda

77151 of 119935 relevant lines covered (64.33%)

227108.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/base_layer/core/src/base_node/service/error.rs
1
// Copyright 2019 The Tari Project
2
//
3
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
4
// following conditions are met:
5
//
6
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
7
// disclaimer.
8
//
9
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
10
// following disclaimer in the documentation and/or other materials provided with the distribution.
11
//
12
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
13
// products derived from this software without specific prior written permission.
14
//
15
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22

23
use tari_comms_dht::outbound::DhtOutboundError;
24
use thiserror::Error;
25

26
use crate::{
27
    base_node::{comms_interface::CommsInterfaceError, service::initializer::ExtractBlockError},
28
    common::{BanPeriod, BanReason},
29
};
30

31
#[derive(Debug, Error)]
32
pub enum BaseNodeServiceError {
33
    #[error("Comms interface error: `{0}`")]
34
    CommsInterfaceError(#[from] CommsInterfaceError),
35
    #[error("DHT outbound error: `{0}`")]
36
    DhtOutboundError(#[from] DhtOutboundError),
37
    #[error("Invalid request error: `{0}`")]
38
    InvalidRequest(String),
39
    #[error("Invalid response error: `{0}`")]
40
    InvalidResponse(String),
41
    #[error("Invalid block error: `{0}`")]
42
    InvalidBlockMessage(#[from] ExtractBlockError),
43
}
44

45
impl BaseNodeServiceError {
46
    pub fn get_ban_reason(&self) -> Option<BanReason> {
×
47
        match self {
×
48
            BaseNodeServiceError::CommsInterfaceError(e) => e.get_ban_reason(),
×
49
            BaseNodeServiceError::DhtOutboundError(_) => None,
×
50
            err @ BaseNodeServiceError::InvalidRequest(_) |
×
51
            err @ BaseNodeServiceError::InvalidResponse(_) |
×
52
            err @ BaseNodeServiceError::InvalidBlockMessage(_) => Some(BanReason {
×
53
                reason: err.to_string(),
×
54
                ban_duration: BanPeriod::Long,
×
55
            }),
×
56
        }
57
    }
×
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc