launchdarkly / rust-server-sdk

LaunchDarkly Server-Side SDK for Rust
https://docs.launchdarkly.com/sdk/server-side/rust
Other
18 stars 13 forks source link

config::BuildError is not re-exported #56

Closed saks closed 10 months ago

saks commented 10 months ago

Is this a support request? No

Describe the bug SDK does not allow for semantic error handling since config::BuildError is not re-exported, hence it is impossible to convert this type to anything explicitly.

To reproduce

use launchdarkly_server_sdk::{Config, ConfigBuilder};

struct MyError {}

fn build_config() -> Result<Config, MyError> {
    let config = ConfigBuilder::new("").build()?;

    Ok(config)
}

impl From<launchdarkly_server_sdk::config::BuildError> for MyError {
    fn from(value: launchdarkly_server_sdk::config::BuildError) -> Self {
        todo!()
    }
}

Expected behavior I expect config::BuildError to be exposed in the same way as client::BuildError is.

Logs cargo c output:

error[E0603]: module `config` is private
  --> src/main.rs:11:36
   |
11 | impl From<launchdarkly_server_sdk::config::BuildError> for MyError {
   |                                    ^^^^^^  ---------- enum `BuildError` is not publicly re-exported
   |                                    |
   |                                    private module
   |
note: the module `config` is defined here
  --> /home/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/launchdarkly-server-sdk-2.0.0/src/lib.rs:52:1

SDK version 2.0.0

Language version, developer tools

# rustc --version
rustc 1.74.0 (79e9716c9 2023-11-13)
# cargo --version
cargo 1.74.0 (ecb9851af 2023-10-18)

OS/platform

cargo -vV
cargo 1.74.0 (ecb9851af 2023-10-18)
release: 1.74.0
commit-hash: ecb9851afd3095e988daaa35a48bc7f3cb748e04
commit-date: 2023-10-18
host: x86_64-unknown-linux-gnu
libgit2: 1.7.1 (sys:0.18.0 vendored)
libcurl: 8.4.0-DEV (sys:0.4.68+curl-8.4.0 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Ubuntu 22.04 (jammy) [64-bit]

Additional context No

keelerm84 commented 10 months ago

Thank you for bringing this to our attention. https://github.com/launchdarkly/rust-server-sdk/pull/57 is up with the fix. We will let you know once this has been released.

keelerm84 commented 10 months ago

Fixed in v2.0.1

saks commented 10 months ago

Thank you for the timely fix! Much appreciated!