-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kbs_protocol: use thiserror for error handling
Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
- Loading branch information
Showing
11 changed files
with
153 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2023 Alibaba Cloud | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
use thiserror::Error; | ||
|
||
pub type Result<T> = std::result::Result<T, Error>; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum Error { | ||
#[error("decrypt KBS response body failed: {0}")] | ||
DecryptResponseFailed(String), | ||
|
||
#[error("get key pair failed: {0}")] | ||
GenerateKeyPairFailed(String), | ||
|
||
#[error("get evidence failed: {0}")] | ||
GetEvidence(String), | ||
|
||
#[error("get token failed: {0}")] | ||
GetTokenFailed(String), | ||
|
||
#[error("get tee type failed: {0}")] | ||
GetTeeTypeFailed(String), | ||
|
||
#[error("http request failed: {0}")] | ||
HttpError(String), | ||
|
||
#[error("KBS internal error: {0}")] | ||
KbsInternalError(String), | ||
|
||
#[error("deserialize http response failed: {0}")] | ||
KbsResponseDeserializationFailed(String), | ||
|
||
#[error("Native Evidence Provider error: {0}")] | ||
NativeEvidenceProvider(String), | ||
|
||
#[error("RCAR handshake failed: {0}")] | ||
RcarHandshake(String), | ||
|
||
#[error("KBS resource not found: {0}")] | ||
ResourceNotFound(String), | ||
|
||
#[error("request unautorized")] | ||
UnAuthorized, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.