Skip to content

Commit

Permalink
tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHougaard committed Oct 26, 2024
1 parent d9f0459 commit 02bc13b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions crates/infisical/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ pub enum Error {
SecretBadRequest { message: String },

// Access token 404 error
#[error("Failed to authenticate, did you provide the correct site URL?")]
NotFoundAccessTokenRequest,
#[error("Failed to authenticate, did you provide the correct site URL?, {}", .message)]
NotFoundAccessTokenRequest { message: String },

// Access token 401 error
#[error("[Failed to authenticate]: Did you provide the correct client ID and secret?")]
Expand Down Expand Up @@ -117,7 +117,16 @@ pub async fn api_error_handler(
) -> Result<Error> {
if status == StatusCode::NOT_FOUND {
if is_auth_request {
return Err(Error::NotFoundAccessTokenRequest);
let r = res.json::<BadRequestError>().await;

match r {
Ok(r) => return Err(Error::NotFoundAccessTokenRequest { message: r.message }),
Err(_) => {
return Err(Error::NotFoundAccessTokenRequest {
message: "Unknown error".to_string(),
})
}
}
}

let s = match secret_name {
Expand Down
2 changes: 1 addition & 1 deletion languages/ruby/infisical-sdk/lib/infisical-sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module InfisicalSDK
class InfisicalClient
attr_reader :infisical, :command_runner, :secrets, :auth, :cryptography

def initialize(site_url = "https://app.infisical.com", cache_ttl = 300)
def initialize(site_url = nil, cache_ttl = 300)
settings = ClientSettings.new(
# We preset these values or we'll get type validation errors (thanks Quicktype!)
access_token: nil,
Expand Down

0 comments on commit 02bc13b

Please sign in to comment.