diff --git a/README.md b/README.md index 4007ef8..568d2a6 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,11 @@ cargo add ckanaction Run `/package_list` endpoint with a limit of 5 results per page and print the output: ```rust +use ckanaction::CKANError; use dotenvy::dotenv; #[tokio::main] -async fn main() -> Result<(), Box> { +async fn main() -> Result<(), CKANError> { // Load environment variables from .env file dotenv()?; diff --git a/docs/content/docs/index.mdx b/docs/content/docs/index.mdx index 6f7b3cb..ecba4e8 100644 --- a/docs/content/docs/index.mdx +++ b/docs/content/docs/index.mdx @@ -11,10 +11,11 @@ This means that instead of using generic request library crates such as `reqwest For example the following code can be ran to send an HTTP POST request to the `/package_list` endpoint of a local CKAN instance's API by using the `ckanaction` crate: ```rust +use ckanaction::CKANError; use dotenvy::dotenv; #[tokio::main] -async fn main() -> Result<(), Box> { +async fn main() -> Result<(), CKANError> { // Load environment variables from .env file dotenv()?; diff --git a/docs/lib/openapi.yml b/docs/lib/openapi.yml index ec03700..45479c4 100644 --- a/docs/lib/openapi.yml +++ b/docs/lib/openapi.yml @@ -48,10 +48,11 @@ paths: - lang: rust label: Rust SDK (ckanaction) example source: | + use ckanaction::CKANError; use dotenvy::dotenv; #[tokio::main] - async fn main() -> Result<(), Box> { + async fn main() -> Result<(), CKANError> { // Load environment variables from .env file dotenv()?; @@ -420,10 +421,11 @@ paths: - lang: rust label: Rust SDK (ckanaction) example source: | + use ckanaction::CKANError; use dotenvy::dotenv; #[tokio::main] - async fn main() -> Result<(), Box> { + async fn main() -> Result<(), CKANError> { // Load environment variables from .env file dotenv()?; @@ -814,10 +816,11 @@ paths: - lang: rust label: Rust SDK (ckanaction) example source: | + use ckanaction::CKANError; use dotenvy::dotenv; #[tokio::main] - async fn main() -> Result<(), Box> { + async fn main() -> Result<(), CKANError> { // Load environment variables from .env file dotenv()?; @@ -1024,10 +1027,11 @@ paths: - lang: rust label: Rust SDK (ckanaction) example source: | + use ckanaction::CKANError; use dotenvy::dotenv; #[tokio::main] - async fn main() -> Result<(), Box> { + async fn main() -> Result<(), CKANError> { // Load environment variables from .env file dotenv()?; diff --git a/examples/status-show/src/main.rs b/examples/status-show/src/main.rs index 225bb5e..c0dc6c8 100644 --- a/examples/status-show/src/main.rs +++ b/examples/status-show/src/main.rs @@ -1,6 +1,7 @@ -#[tokio::main] -async fn main() -> Result<(), Box> { +use ckanaction::CKANError; +#[tokio::main] +async fn main() -> Result<(), CKANError> { // Initialize and build CKAN struct let ckan = ckanaction::CKAN::builder() .url("http://localhost:5000") diff --git a/tests/general.rs b/tests/general.rs index 77a67d0..0c09ad5 100644 --- a/tests/general.rs +++ b/tests/general.rs @@ -1,4 +1,4 @@ -use ckanaction::CKAN; +use ckanaction::{CKAN, CKANError}; const CKAN_API_TOKEN: &str = ""; const CKAN_URL: &str = ""; @@ -12,7 +12,7 @@ pub async fn get_ckan_builder() -> CKAN { #[tokio::test] #[ignore = "Set values for const at top of tests file locally."] -async fn status_show() -> Result<(), Box> { +async fn status_show() -> Result<(), CKANError> { let ckan = get_ckan_builder().await; let response = ckan.status_show().await?; assert!(response.is_object()); @@ -28,7 +28,7 @@ async fn status_show() -> Result<(), Box> { } #[tokio::test] -async fn print_ckan_struct_with_debug() -> Result<(), Box> { +async fn print_ckan_struct_with_debug() -> Result<(), CKANError> { let ckan = get_ckan_builder().await; assert_eq!(format!("{ckan:?}"), r#"CKAN { url: "", token: Some("") }"#); Ok(())