Improved error handling (part 4)

This commit is contained in:
mdecimus
2024-07-18 20:04:09 +02:00
parent d2ad44cf9f
commit d48523583b
70 changed files with 1114 additions and 973 deletions

View File

@@ -88,7 +88,7 @@ async fn lmtp_directory() {
Item::Verify(v) => match core.vrfy(&handle, v).await {
Ok(v) => v.into(),
Err(e) => {
if e.matches(trc::StoreCause::NotSupported) {
if e.matches(trc::Cause::Store(trc::StoreCause::NotSupported)) {
LookupResult::False
} else {
panic!("Unexpected error: {e:?}")
@@ -98,7 +98,7 @@ async fn lmtp_directory() {
Item::Expand(v) => match core.expn(&handle, v).await {
Ok(v) => v.into(),
Err(e) => {
if e.matches(trc::StoreCause::NotSupported) {
if e.matches(trc::Cause::Store(trc::StoreCause::NotSupported)) {
LookupResult::False
} else {
panic!("Unexpected error: {e:?}")
@@ -132,7 +132,7 @@ async fn lmtp_directory() {
Item::Verify(v) => match core.vrfy(&handle, v).await {
Ok(v) => v.into(),
Err(e) => {
if e.matches(trc::StoreCause::NotSupported) {
if e.matches(trc::Cause::Store(trc::StoreCause::NotSupported)) {
LookupResult::False
} else {
panic!("Unexpected error: {e:?}")
@@ -142,7 +142,7 @@ async fn lmtp_directory() {
Item::Expand(v) => match core.expn(&handle, v).await {
Ok(v) => v.into(),
Err(e) => {
if e.matches(trc::StoreCause::NotSupported) {
if e.matches(trc::Cause::Store(trc::StoreCause::NotSupported)) {
LookupResult::False
} else {
panic!("Unexpected error: {e:?}")

View File

@@ -689,7 +689,7 @@ pub async fn test_account_login(login: &str, secret: &str) -> Client {
#[derive(Deserialize)]
#[serde(untagged)]
pub enum Response<T> {
RequestError(RequestError),
RequestError(RequestError<'static>),
Error { error: String, details: String },
Data { data: T },
}

View File

@@ -140,7 +140,7 @@ pub fn spawn_mock_webhook_endpoint() -> Arc<MockWebhookEndpoint> {
//let c = print!("rejected webhook: {}", serde_json::to_string_pretty(&request).unwrap());
Ok::<_, hyper::Error>(
Err(trc::ResourceCause::NotFound.into_err())
RequestError::not_found().into_http_response()
)
}