Skip to content

remove Box<dyn Error> from storage core #814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk/storage/examples/account00.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use azure_core::error::Result;
use azure_storage::core::prelude::*;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
async fn main() -> Result<()> {
// First we retrieve the account name and master key from environment variables.
let account =
std::env::var("STORAGE_ACCOUNT").expect("Set env variable STORAGE_ACCOUNT first!");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::account::responses::ListBlobsByTagsResponse;
use crate::core::prelude::*;
use azure_core::error::Result;
use azure_core::headers::add_optional_header;
use azure_core::prelude::*;
use std::convert::TryInto;
Expand Down Expand Up @@ -40,9 +41,7 @@ impl<'a> FindBlobsByTagsBuilder<'a> {
timeout: Timeout => Some(timeout),
}

pub async fn execute(
&self,
) -> Result<ListBlobsByTagsResponse, Box<dyn std::error::Error + Send + Sync>> {
pub async fn execute(&self) -> Result<ListBlobsByTagsResponse> {
let mut url = self
.client
.storage_account_client()
Expand Down Expand Up @@ -73,6 +72,6 @@ impl<'a> FindBlobsByTagsBuilder<'a> {

debug!("response.headers() == {:#?}", response.headers());

Ok((&response).try_into()?)
(&response).try_into()
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::account::responses::GetAccountInformationResponse;
use crate::core::prelude::*;
use azure_core::error::Result;

#[derive(Debug, Clone)]
pub struct GetAccountInformationBuilder<'a> {
Expand All @@ -13,9 +14,7 @@ impl<'a> GetAccountInformationBuilder<'a> {
}

impl<'a> GetAccountInformationBuilder<'a> {
pub async fn execute(
self,
) -> Result<GetAccountInformationResponse, Box<dyn std::error::Error + Send + Sync>> {
pub async fn execute(self) -> Result<GetAccountInformationResponse> {
let mut url = self
.storage_client
.storage_account_client()
Expand All @@ -40,8 +39,6 @@ impl<'a> GetAccountInformationBuilder<'a> {
.execute_request_check_status(request, http::StatusCode::OK)
.await?;

Ok(GetAccountInformationResponse::from_headers(
response.headers(),
)?)
GetAccountInformationResponse::from_headers(response.headers())
}
}