-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Output better errors from wasm (#466)
- Loading branch information
Showing
10 changed files
with
192 additions
and
92 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
Binary file not shown.
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,71 @@ | ||
use account_sdk::signers::SignError; | ||
use base64::DecodeError; | ||
use coset::CoseError; | ||
use starknet::{ | ||
accounts::AccountError, | ||
core::{types::FromStrError, utils::NonAsciiNameError}, | ||
}; | ||
use thiserror::Error; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum CartridgeError { | ||
#[error("Session error: {0}")] | ||
Session(#[from] SessionError), | ||
|
||
#[error("Account operation error: {0}")] | ||
Operation(#[from] OperationError), | ||
|
||
#[error("Encoding error: {0}")] | ||
Encoding(#[from] EncodingError), | ||
} | ||
|
||
#[derive(Error, Debug)] | ||
pub enum SessionError { | ||
#[error("Failed to create session: {0}")] | ||
Creation(SignError), | ||
|
||
#[error("Failed to sign message: {0}")] | ||
Signing(SignError), | ||
} | ||
|
||
#[derive(Error, Debug)] | ||
pub enum OperationError { | ||
#[error("Failed to delegate account: {0}")] | ||
Delegation(String), | ||
|
||
#[error("Failed to estimate fee: {0}")] | ||
FeeEstimation(String), | ||
|
||
#[error("Failed to execute transaction: {0}")] | ||
Execution(String), | ||
|
||
#[error("Failed to deploy account: {0}")] | ||
Deployment(String), | ||
|
||
#[error("Failed to sign message: {0}")] | ||
SignMessage(SignError), | ||
|
||
#[error(transparent)] | ||
AccountError(#[from] AccountError<SignError>), | ||
} | ||
|
||
#[derive(Error, Debug)] | ||
pub enum EncodingError { | ||
#[error(transparent)] | ||
FromStr(#[from] FromStrError), | ||
|
||
#[error(transparent)] | ||
NonAsciiName(#[from] NonAsciiNameError), | ||
|
||
#[error("Base64 decoding error: {0}")] | ||
Base64Decode(#[from] DecodeError), | ||
|
||
#[error("COSE key error: {0}")] | ||
CoseKey(#[from] CoseError), | ||
|
||
#[error("Invalid JSON: {0}")] | ||
Json(#[from] serde_json::Error), | ||
|
||
#[error("Serialization error: {0}")] | ||
Serialization(#[from] serde_wasm_bindgen::Error), | ||
} |
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.