Skip to content

dns_update::Error does not implement std::error::Error #8

@jcgruenhage

Description

@jcgruenhage

This makes usage in places where errors are expected to implement this trait difficult. The simplest patch for this would look like this:

commit b606c5a4964d0b2def6e13fa5c968d1da14ba0b2
Author: Jan Christian Grünhage <jan.christian@gruenhage.xyz>
Date:   Fri Oct 4 13:14:41 2024 +0200

    wip: improve error handling

diff --git a/Cargo.toml b/Cargo.toml
index 323dad8..1aaa8b0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,7 @@ serde = { version = "1.0.197", features = ["derive"] }
 serde_json = "1.0.116"
 reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-webpki-roots", "http2"]}
 serde_urlencoded = "0.7.1"
+thiserror = "1.0.64"
 
 [dev-dependencies]
 tokio = { version = "1", features = ["full"] }
diff --git a/src/lib.rs b/src/lib.rs
index fcb2354..a71781c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,11 +23,12 @@ use providers::{
     cloudflare::CloudflareProvider,
     rfc2136::{DnsAddress, Rfc2136Provider},
 };
+use thiserror::Error;
 
 pub mod http;
 pub mod providers;
 
-#[derive(Debug)]
+#[derive(Debug, Error)]
 pub enum Error {
     Protocol(String),
     Parse(String),

It probably makes sense to put a bit more effort into this and think about error handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions