diff --git a/.github/workflows/ic-ref.yml b/.github/workflows/ic-ref.yml index fad3fb13..73e99fd4 100644 --- a/.github/workflows/ic-ref.yml +++ b/.github/workflows/ic-ref.yml @@ -16,7 +16,7 @@ jobs: include: - build: linux-stable ghc: '8.8.4' - spec: 'release-0.11' + spec: 'release-0.13' os: ubuntu-latest rust: stable @@ -75,7 +75,7 @@ jobs: mkdir -p $HOME/bin cd ic-ref/impl cabal update - cabal install -w ghc-${{ matrix.ghc }} --overwrite-policy=always --installdir=$HOME/bin + cabal install exe:ic-ref -w ghc-${{ matrix.ghc }} --overwrite-policy=always --installdir=$HOME/bin - name: Build universal-canister run: | diff --git a/ic-agent/Cargo.toml b/ic-agent/Cargo.toml index 5c094f19..d214cf75 100644 --- a/ic-agent/Cargo.toml +++ b/ic-agent/Cargo.toml @@ -21,6 +21,7 @@ delay = "0.3.0" hex = "0.4.0" ic-types = { path = "../ic-types", version = "0.1", features = [ "serde" ] } leb128 = "0.2.4" +mime = "0.3.16" openssl = "0.10.24" rand = "0.7.2" reqwest = { version = "0.10.4", features = [ "blocking", "json", "rustls-tls" ] } diff --git a/ic-agent/src/agent/agent_error.rs b/ic-agent/src/agent/agent_error.rs index 921ea62f..d712c736 100644 --- a/ic-agent/src/agent/agent_error.rs +++ b/ic-agent/src/agent/agent_error.rs @@ -1,4 +1,8 @@ +use crate::hash_tree::Label; use crate::RequestIdError; +use leb128::read; +use std::fmt::{Debug, Display, Formatter}; +use std::str::Utf8Error; use thiserror::Error; #[derive(Error, Debug)] @@ -36,12 +40,8 @@ pub enum AgentError { reject_message: String, }, - #[error(r#"The replica returned an HTTP Error: status code {status}"#)] - HttpError { - status: u16, - content_type: Option, - content: Vec, - }, + #[error("The replica returned an HTTP Error: {0}")] + HttpError(HttpErrorPayload), #[error("HTTP Authentication cannot be used in a non-secure URL (either HTTPS or localhost)")] CannotUseAuthenticationOnNonSecureUrl(), @@ -60,6 +60,24 @@ pub enum AgentError { #[error("A tool returned a custom error: {0}")] CustomError(#[from] Box), + + #[error("Error reading LEB128 value: {0}")] + Leb128ReadError(#[from] read::Error), + + #[error("Error in UTF-8 string: {0}")] + Utf8ReadError(#[from] Utf8Error), + + #[error("The lookup path ({0:?}) is absent in the certificate.")] + LookupPathAbsent(Vec