Skip to content

Tracker Checker (HTTP): Improve error message when the JSON config is not well-formatted #1042

@josecelano

Description

@josecelano

Parent issue: #669

When you run the checker for more than one HTTP tracker and it fails, it only shows an error but not the cause.

How to reproduce

Run the checker without running the tracker:

TORRUST_CHECKER_CONFIG='{
    "udp_trackers": [],
    "http_trackers": [
	"http://127.0.0.1:7070",
	"http://127.0.0.1:7070/",
	"http://127.0.0.1:7070/announce",
    ],
    "health_checks": []
}' cargo run --bin tracker_checker
    Finished `dev` profile [optimized + debuginfo] target(s) in 0.09s
     Running `target/debug/tracker_checker`
thread 'main' panicked at src/bin/tracker_checker.rs:6:22:
Some checks fail: invalid config format

Caused by:
    JSON parse error: trailing comma at line 7 column 5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions