mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-29 23:11:01 +00:00
aws: rely on WaitError Display implementation
The Display implementation of WaitError already displays the underlying SDK error and the metadata, so can just use that. Will also be used to provide more context in the next patch. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1638>
This commit is contained in:
parent
0bd98e2c34
commit
3b7b2cd37b
3 changed files with 21 additions and 24 deletions
|
@ -14,7 +14,6 @@ use gst_base::subclass::prelude::*;
|
||||||
|
|
||||||
use aws_sdk_s3::{
|
use aws_sdk_s3::{
|
||||||
config::{self, retry::RetryConfig, Credentials, Region},
|
config::{self, retry::RetryConfig, Credentials, Region},
|
||||||
error::ProvideErrorMetadata,
|
|
||||||
operation::{
|
operation::{
|
||||||
abort_multipart_upload::builders::AbortMultipartUploadFluentBuilder,
|
abort_multipart_upload::builders::AbortMultipartUploadFluentBuilder,
|
||||||
complete_multipart_upload::builders::CompleteMultipartUploadFluentBuilder,
|
complete_multipart_upload::builders::CompleteMultipartUploadFluentBuilder,
|
||||||
|
@ -269,12 +268,12 @@ impl S3Sink {
|
||||||
|
|
||||||
let upload_part_req_future = upload_part_req.send();
|
let upload_part_req_future = upload_part_req.send();
|
||||||
let output =
|
let output =
|
||||||
s3utils::wait(&self.canceller, upload_part_req_future).map_err(|err| match err {
|
s3utils::wait(&self.canceller, upload_part_req_future).map_err(|err| match &err {
|
||||||
WaitError::FutureError(err) => {
|
WaitError::FutureError(_) => {
|
||||||
self.flush_multipart_upload(state);
|
self.flush_multipart_upload(state);
|
||||||
Some(gst::error_msg!(
|
Some(gst::error_msg!(
|
||||||
gst::ResourceError::OpenWrite,
|
gst::ResourceError::OpenWrite,
|
||||||
["Failed to upload part: {err}: {}", err.meta()]
|
["Failed to upload part: {err}"]
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
WaitError::Cancelled => None,
|
WaitError::Cancelled => None,
|
||||||
|
@ -418,11 +417,11 @@ impl S3Sink {
|
||||||
|
|
||||||
s3utils::wait(&self.abort_multipart_canceller, abort_req_future)
|
s3utils::wait(&self.abort_multipart_canceller, abort_req_future)
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
.map_err(|err| match err {
|
.map_err(|err| match &err {
|
||||||
WaitError::FutureError(err) => {
|
WaitError::FutureError(_) => {
|
||||||
gst::error_msg!(
|
gst::error_msg!(
|
||||||
gst::ResourceError::Write,
|
gst::ResourceError::Write,
|
||||||
["Failed to abort multipart upload: {err}: {}", err.meta()]
|
["Failed to abort multipart upload: {err}"]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
WaitError::Cancelled => {
|
WaitError::Cancelled => {
|
||||||
|
@ -443,10 +442,10 @@ impl S3Sink {
|
||||||
|
|
||||||
s3utils::wait(&self.canceller, complete_req_future)
|
s3utils::wait(&self.canceller, complete_req_future)
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
.map_err(|err| match err {
|
.map_err(|err| match &err {
|
||||||
WaitError::FutureError(err) => gst::error_msg!(
|
WaitError::FutureError(_) => gst::error_msg!(
|
||||||
gst::ResourceError::Write,
|
gst::ResourceError::Write,
|
||||||
["Failed to complete multipart upload: {err}: {}", err.meta()]
|
["Failed to complete multipart upload: {err}"]
|
||||||
),
|
),
|
||||||
WaitError::Cancelled => {
|
WaitError::Cancelled => {
|
||||||
gst::error_msg!(
|
gst::error_msg!(
|
||||||
|
@ -554,10 +553,10 @@ impl S3Sink {
|
||||||
let create_multipart_req_future = create_multipart_req.send();
|
let create_multipart_req_future = create_multipart_req.send();
|
||||||
|
|
||||||
let response = s3utils::wait(&self.canceller, create_multipart_req_future).map_err(
|
let response = s3utils::wait(&self.canceller, create_multipart_req_future).map_err(
|
||||||
|err| match err {
|
|err| match &err {
|
||||||
WaitError::FutureError(err) => gst::error_msg!(
|
WaitError::FutureError(_) => gst::error_msg!(
|
||||||
gst::ResourceError::OpenWrite,
|
gst::ResourceError::OpenWrite,
|
||||||
["Failed to create multipart upload: {err}: {}", err.meta()]
|
["Failed to create multipart upload: {err}"]
|
||||||
),
|
),
|
||||||
WaitError::Cancelled => {
|
WaitError::Cancelled => {
|
||||||
gst::error_msg!(
|
gst::error_msg!(
|
||||||
|
|
|
@ -15,7 +15,6 @@ use gst_base::subclass::prelude::*;
|
||||||
|
|
||||||
use aws_sdk_s3::{
|
use aws_sdk_s3::{
|
||||||
config::{self, retry::RetryConfig, Credentials, Region},
|
config::{self, retry::RetryConfig, Credentials, Region},
|
||||||
error::ProvideErrorMetadata,
|
|
||||||
operation::put_object::builders::PutObjectFluentBuilder,
|
operation::put_object::builders::PutObjectFluentBuilder,
|
||||||
primitives::ByteStream,
|
primitives::ByteStream,
|
||||||
Client,
|
Client,
|
||||||
|
@ -208,10 +207,10 @@ impl S3PutObjectSink {
|
||||||
|
|
||||||
let put_object_req_future = put_object_req.send();
|
let put_object_req_future = put_object_req.send();
|
||||||
let _output =
|
let _output =
|
||||||
s3utils::wait(&self.canceller, put_object_req_future).map_err(|err| match err {
|
s3utils::wait(&self.canceller, put_object_req_future).map_err(|err| match &err {
|
||||||
WaitError::FutureError(err) => Some(gst::error_msg!(
|
WaitError::FutureError(_) => Some(gst::error_msg!(
|
||||||
gst::ResourceError::OpenWrite,
|
gst::ResourceError::OpenWrite,
|
||||||
["Failed to upload object: {err}: {}", err.meta()]
|
["Failed to upload object: {err}"]
|
||||||
)),
|
)),
|
||||||
WaitError::Cancelled => None,
|
WaitError::Cancelled => None,
|
||||||
})?;
|
})?;
|
||||||
|
|
|
@ -13,7 +13,6 @@ use std::time::Duration;
|
||||||
|
|
||||||
use aws_sdk_s3::{
|
use aws_sdk_s3::{
|
||||||
config::{self, retry::RetryConfig, Credentials},
|
config::{self, retry::RetryConfig, Credentials},
|
||||||
error::ProvideErrorMetadata,
|
|
||||||
Client,
|
Client,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -177,10 +176,10 @@ impl S3Src {
|
||||||
let head_object_future = head_object.send();
|
let head_object_future = head_object.send();
|
||||||
|
|
||||||
let output =
|
let output =
|
||||||
s3utils::wait(&self.canceller, head_object_future).map_err(|err| match err {
|
s3utils::wait(&self.canceller, head_object_future).map_err(|err| match &err {
|
||||||
WaitError::FutureError(err) => gst::error_msg!(
|
WaitError::FutureError(_) => gst::error_msg!(
|
||||||
gst::ResourceError::NotFound,
|
gst::ResourceError::NotFound,
|
||||||
["Failed to get HEAD object: {err}: {}", err.meta()]
|
["Failed to get HEAD object: {err}"]
|
||||||
),
|
),
|
||||||
WaitError::Cancelled => {
|
WaitError::Cancelled => {
|
||||||
gst::error_msg!(
|
gst::error_msg!(
|
||||||
|
@ -236,10 +235,10 @@ impl S3Src {
|
||||||
let get_object_future = get_object.send();
|
let get_object_future = get_object.send();
|
||||||
|
|
||||||
let mut output =
|
let mut output =
|
||||||
s3utils::wait(&self.canceller, get_object_future).map_err(|err| match err {
|
s3utils::wait(&self.canceller, get_object_future).map_err(|err| match &err {
|
||||||
WaitError::FutureError(err) => Some(gst::error_msg!(
|
WaitError::FutureError(_) => Some(gst::error_msg!(
|
||||||
gst::ResourceError::Read,
|
gst::ResourceError::Read,
|
||||||
["Could not read: {err}: {}", err.meta()]
|
["Could not read: {err}"]
|
||||||
)),
|
)),
|
||||||
WaitError::Cancelled => None,
|
WaitError::Cancelled => None,
|
||||||
})?;
|
})?;
|
||||||
|
|
Loading…
Reference in a new issue