Skip to content

Commit

Permalink
payment: add error instances
Browse files Browse the repository at this point in the history
  • Loading branch information
kamirr committed Jul 9, 2024
1 parent 871dce4 commit aab950b
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions core/payment/src/api/allocations/api_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ pub fn try_from_validation(

details
.with_type(Uri::from_static(
"/payment-api/v1/allocations/validation/insufficient-account-funds",
"/payment-api/v1/allocations/validation-error",
))
.with_instance(Uri::from_static(
"/payment-api/v1/allocations/validation-error/insufficient-account-funds",
))
.with_detail(detail)
}
Expand All @@ -77,7 +80,10 @@ pub fn try_from_validation(

details
.with_type(Uri::from_static(
"/payment-api/v1/allocations/validation/insufficient-deposit-funds",
"/payment-api/v1/allocations/validation-error",
))
.with_instance(Uri::from_static(
"/payment-api/v1/allocations/validation-error/insufficient-deposit-funds",
))
.with_detail(detail)
}
Expand All @@ -101,7 +107,10 @@ pub fn try_from_validation(

details
.with_type(Uri::from_static(
"/payment-api/v1/allocations/validation/timeout-exceeds-deposit",
"/payment-api/v1/allocations/validation-error",
))
.with_instance(Uri::from_static(
"/payment-api/v1/allocations/validation-error/timeout-exceeds-deposit",
))
.with_detail(detail)
}
Expand All @@ -115,7 +124,10 @@ pub fn try_from_validation(

details
.with_type(Uri::from_static(
"/payment-api/v1/allocations/validation/timeout-passed",
"/payment-api/v1/allocations/validation-error",
))
.with_instance(Uri::from_static(
"/payment-api/v1/allocations/validation-error/timeout-passed",
))
.with_detail(detail)
}
Expand All @@ -124,7 +136,10 @@ pub fn try_from_validation(

details
.with_type(Uri::from_static(
"/payment-api/v1/allocations/validation/malformed-deposit-contract",
"/payment-api/v1/allocations/validation-error",
))
.with_instance(Uri::from_static(
"/payment-api/v1/allocations/validation-error/malformed-deposit-contract",
))
.with_detail(detail)
}
Expand All @@ -133,7 +148,10 @@ pub fn try_from_validation(

details
.with_type(Uri::from_static(
"/payment-api/v1/allocations/validation/malformed-deposit-id",
"/payment-api/v1/allocations/validation-error",
))
.with_instance(Uri::from_static(
"/payment-api/v1/allocations/validation-error/malformed-deposit-id",
))
.with_detail(detail)
}
Expand All @@ -150,7 +168,10 @@ pub fn try_from_validation(

details
.with_type(Uri::from_static(
"/payment-api/v1/allocations/validation/deposit-reused",
"/payment-api/v1/allocations/validation-error",
))
.with_instance(Uri::from_static(
"/payment-api/v1/allocations/validation-error/deposit-reused",
))
.with_detail(detail)
}
Expand All @@ -161,7 +182,10 @@ pub fn try_from_validation(

details
.with_type(Uri::from_static(
"/payment-api/v1/allocations/validation/deposit-spender-mismatch",
"/payment-api/v1/allocations/validation-error",
))
.with_instance(Uri::from_static(
"/payment-api/v1/allocations/validation-error/deposit-spender-mismatch",
))
.with_detail(detail)
}
Expand All @@ -170,7 +194,10 @@ pub fn try_from_validation(

details
.with_type(Uri::from_static(
"/payment-api/v1/allocations/validation/deposit-validation-error",
"/payment-api/v1/allocations/validation-error",
))
.with_instance(Uri::from_static(
"/payment-api/v1/allocations/validation-error/deposit-validation-error",
))
.with_detail(detail)
}
Expand Down

0 comments on commit aab950b

Please sign in to comment.