-
Notifications
You must be signed in to change notification settings - Fork 51
Tracker Checker: Improve errors. More concrete errors #676
Copy link
Copy link
Closed
Labels
- Admin -Enjoyable to Install and Setup our SoftwareEnjoyable to Install and Setup our Software- Developer -Torrust Improvement ExperienceTorrust Improvement ExperienceCode Cleanup / RefactoringTidying and Making NeatTidying and Making NeatEasyGood for NewcomersGood for NewcomersEnhancement / Feature RequestSomething NewSomething NewLow PriorityNot our Focus NowNot our Focus NowTestingChecking TorrustChecking Torrustgood first issueGood for newcomersGood for newcomers
Milestone
Description
Parent issue: #669
Relates to:
- Tracker Checker: handle UDP Tracker timeouts #682
- Tracker Checker: handle HTTP Tracker timeouts #679
- Tracker Checker: handle Health Check timeouts #678
- Tracker Checker: handle HTTP Tracker error
ConnectionRefused#683
Currently, you can run the Tracker Checker with this input:
TORRUST_CHECKER_CONFIG='{
"udp_trackers": ["144.126.245.19:6969"],
"http_trackers": ["https://tracker.torrust-demo.com"],
"health_checks": ["https://tracker.torrust-demo.com/health_check"]
}' cargo run --bin tracker_checkerWhen something is wrong you only get three types of errors or the application panics.
For example:
TORRUST_CHECKER_CONFIG='{
"udp_trackers": [],
"http_trackers": [],
"health_checks": ["https://localhost:1515"]
}' cargo run --bin tracker_checkerOutput:
Running checks for trackers ...
UDP trackers ...
HTTP trackers ...
Health checks ...
✗ - Health API at https://localhost:1515/ is failing: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(1515), path: "/", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })) }
Errors are defined with this enum:
#[derive(Debug)]
pub enum CheckError {
UdpError { socket_addr: SocketAddr },
HttpError { url: Url },
HealthCheckError { url: Url },
}But depending on the service there could be different reasons. For example:
For the Health Check:
- The connection can be refused.
- The response status code could not be 200.
- Etcetera.
For the UDP tracker:
- You could not bind the client to a local port.
- You could not send a packet to the remote server.
- Etcetera.
We should introduce a second level of types for errors. For example:
#[derive(Debug)]
pub enum CheckError {
Udp { error: UdpError },
Http { error: HttpError },
HealthCheck { error: HealthCheckError },
}
#[derive(Debug)]
pub enum HealthCheckError {
ConnectionRefused { url: Url },
NotOkResponse { url: Url, status: StatusCode },
HealthCheck { error: HealthCheckError },
}
// ...This issue should be implemented after implementing other issues related to timeout errors. Because those issues might introduce new errors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- Admin -Enjoyable to Install and Setup our SoftwareEnjoyable to Install and Setup our Software- Developer -Torrust Improvement ExperienceTorrust Improvement ExperienceCode Cleanup / RefactoringTidying and Making NeatTidying and Making NeatEasyGood for NewcomersGood for NewcomersEnhancement / Feature RequestSomething NewSomething NewLow PriorityNot our Focus NowNot our Focus NowTestingChecking TorrustChecking Torrustgood first issueGood for newcomersGood for newcomers
Type
Projects
Status
Done