@@ -14,7 +14,7 @@ use crate::vm::types::{BuffData, PrincipalData, QualifiedContractIdentifier};
1414use crate :: vm:: { analysis, ast, ClarityVersion , ContractContext , SymbolicExpression , Value } ;
1515
1616#[ derive( Debug ) ]
17- pub enum Error {
17+ pub enum ClarityError {
1818 Analysis ( CheckError ) ,
1919 Parse ( ParseError ) ,
2020 Interpreter ( InterpreterError ) ,
@@ -33,85 +33,85 @@ pub enum Error {
3333 } ,
3434}
3535
36- impl fmt:: Display for Error {
36+ impl fmt:: Display for ClarityError {
3737 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
3838 match self {
39- Error :: CostError ( ref a, ref b) => {
39+ ClarityError :: CostError ( ref a, ref b) => {
4040 write ! ( f, "Cost Error: {a} cost exceeded budget of {b} cost" )
4141 }
42- Error :: Analysis ( ref e) => fmt:: Display :: fmt ( e, f) ,
43- Error :: Parse ( ref e) => fmt:: Display :: fmt ( e, f) ,
44- Error :: AbortedByCallback { reason, .. } => {
42+ ClarityError :: Analysis ( ref e) => fmt:: Display :: fmt ( e, f) ,
43+ ClarityError :: Parse ( ref e) => fmt:: Display :: fmt ( e, f) ,
44+ ClarityError :: AbortedByCallback { reason, .. } => {
4545 write ! ( f, "Post condition aborted transaction: {reason}" )
4646 }
47- Error :: Interpreter ( ref e) => fmt:: Display :: fmt ( e, f) ,
48- Error :: BadTransaction ( ref s) => fmt:: Display :: fmt ( s, f) ,
47+ ClarityError :: Interpreter ( ref e) => fmt:: Display :: fmt ( e, f) ,
48+ ClarityError :: BadTransaction ( ref s) => fmt:: Display :: fmt ( s, f) ,
4949 }
5050 }
5151}
5252
53- impl std:: error:: Error for Error {
53+ impl std:: error:: Error for ClarityError {
5454 fn cause ( & self ) -> Option < & dyn std:: error:: Error > {
5555 match * self {
56- Error :: CostError ( ref _a, ref _b) => None ,
57- Error :: AbortedByCallback { .. } => None ,
58- Error :: Analysis ( ref e) => Some ( e) ,
59- Error :: Parse ( ref e) => Some ( e) ,
60- Error :: Interpreter ( ref e) => Some ( e) ,
61- Error :: BadTransaction ( ref _s) => None ,
56+ ClarityError :: CostError ( ref _a, ref _b) => None ,
57+ ClarityError :: AbortedByCallback { .. } => None ,
58+ ClarityError :: Analysis ( ref e) => Some ( e) ,
59+ ClarityError :: Parse ( ref e) => Some ( e) ,
60+ ClarityError :: Interpreter ( ref e) => Some ( e) ,
61+ ClarityError :: BadTransaction ( ref _s) => None ,
6262 }
6363 }
6464}
6565
66- impl From < CheckError > for Error {
66+ impl From < CheckError > for ClarityError {
6767 fn from ( e : CheckError ) -> Self {
6868 match * e. err {
6969 CheckErrors :: CostOverflow => {
70- Error :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
70+ ClarityError :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
7171 }
72- CheckErrors :: CostBalanceExceeded ( a, b) => Error :: CostError ( a, b) ,
72+ CheckErrors :: CostBalanceExceeded ( a, b) => ClarityError :: CostError ( a, b) ,
7373 CheckErrors :: MemoryBalanceExceeded ( _a, _b) => {
74- Error :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
74+ ClarityError :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
7575 }
7676 CheckErrors :: ExecutionTimeExpired => {
77- Error :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
77+ ClarityError :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
7878 }
79- _ => Error :: Analysis ( e) ,
79+ _ => ClarityError :: Analysis ( e) ,
8080 }
8181 }
8282}
8383
84- impl From < InterpreterError > for Error {
84+ impl From < InterpreterError > for ClarityError {
8585 fn from ( e : InterpreterError ) -> Self {
8686 match & e {
8787 InterpreterError :: Unchecked ( CheckErrors :: CostBalanceExceeded ( a, b) ) => {
88- Error :: CostError ( a. clone ( ) , b. clone ( ) )
88+ ClarityError :: CostError ( a. clone ( ) , b. clone ( ) )
8989 }
9090 InterpreterError :: Unchecked ( CheckErrors :: CostOverflow ) => {
91- Error :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
91+ ClarityError :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
9292 }
9393 InterpreterError :: Unchecked ( CheckErrors :: ExecutionTimeExpired ) => {
94- Error :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
94+ ClarityError :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
9595 }
96- _ => Error :: Interpreter ( e) ,
96+ _ => ClarityError :: Interpreter ( e) ,
9797 }
9898 }
9999}
100100
101- impl From < ParseError > for Error {
101+ impl From < ParseError > for ClarityError {
102102 fn from ( e : ParseError ) -> Self {
103103 match * e. err {
104104 ParseErrors :: CostOverflow => {
105- Error :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
105+ ClarityError :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
106106 }
107- ParseErrors :: CostBalanceExceeded ( a, b) => Error :: CostError ( a, b) ,
107+ ParseErrors :: CostBalanceExceeded ( a, b) => ClarityError :: CostError ( a, b) ,
108108 ParseErrors :: MemoryBalanceExceeded ( _a, _b) => {
109- Error :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
109+ ClarityError :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
110110 }
111111 ParseErrors :: ExecutionTimeExpired => {
112- Error :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
112+ ClarityError :: CostError ( ExecutionCost :: max_value ( ) , ExecutionCost :: max_value ( ) )
113113 }
114- _ => Error :: Parse ( e) ,
114+ _ => ClarityError :: Parse ( e) ,
115115 }
116116 }
117117}
@@ -210,7 +210,7 @@ pub trait TransactionConnection: ClarityConnection {
210210 clarity_version : ClarityVersion ,
211211 contract_content : & str ,
212212 ast_rules : ASTRules ,
213- ) -> Result < ( ContractAST , ContractAnalysis ) , Error > {
213+ ) -> Result < ( ContractAST , ContractAnalysis ) , ClarityError > {
214214 let epoch_id = self . get_epoch ( ) ;
215215
216216 self . with_analysis_db ( |db, mut cost_track| {
@@ -289,12 +289,12 @@ pub trait TransactionConnection: ClarityConnection {
289289 to : & PrincipalData ,
290290 amount : u128 ,
291291 memo : & BuffData ,
292- ) -> Result < ( Value , AssetMap , Vec < StacksTransactionEvent > ) , Error > {
292+ ) -> Result < ( Value , AssetMap , Vec < StacksTransactionEvent > ) , ClarityError > {
293293 self . with_abort_callback (
294294 |vm_env| {
295295 vm_env
296296 . stx_transfer ( from, to, amount, memo)
297- . map_err ( Error :: from)
297+ . map_err ( ClarityError :: from)
298298 } ,
299299 |_, _| None ,
300300 )
@@ -316,7 +316,7 @@ pub trait TransactionConnection: ClarityConnection {
316316 args : & [ Value ] ,
317317 abort_call_back : F ,
318318 max_execution_time : Option < std:: time:: Duration > ,
319- ) -> Result < ( Value , AssetMap , Vec < StacksTransactionEvent > ) , Error >
319+ ) -> Result < ( Value , AssetMap , Vec < StacksTransactionEvent > ) , ClarityError >
320320 where
321321 F : FnOnce ( & AssetMap , & mut ClarityDatabase ) -> Option < String > ,
322322 {
@@ -340,13 +340,13 @@ pub trait TransactionConnection: ClarityConnection {
340340 public_function,
341341 & expr_args,
342342 )
343- . map_err ( Error :: from)
343+ . map_err ( ClarityError :: from)
344344 } ,
345345 abort_call_back,
346346 )
347347 . and_then ( |( value, assets_modified, tx_events, reason) | {
348348 if let Some ( reason) = reason {
349- Err ( Error :: AbortedByCallback {
349+ Err ( ClarityError :: AbortedByCallback {
350350 output : Some ( Box :: new ( value) ) ,
351351 assets_modified : Box :: new ( assets_modified) ,
352352 tx_events,
@@ -373,7 +373,7 @@ pub trait TransactionConnection: ClarityConnection {
373373 sponsor : Option < PrincipalData > ,
374374 abort_call_back : F ,
375375 max_execution_time : Option < std:: time:: Duration > ,
376- ) -> Result < ( AssetMap , Vec < StacksTransactionEvent > ) , Error >
376+ ) -> Result < ( AssetMap , Vec < StacksTransactionEvent > ) , ClarityError >
377377 where
378378 F : FnOnce ( & AssetMap , & mut ClarityDatabase ) -> Option < String > ,
379379 {
@@ -392,12 +392,12 @@ pub trait TransactionConnection: ClarityConnection {
392392 contract_str,
393393 sponsor,
394394 )
395- . map_err ( Error :: from)
395+ . map_err ( ClarityError :: from)
396396 } ,
397397 abort_call_back,
398398 ) ?;
399399 if let Some ( reason) = reason {
400- Err ( Error :: AbortedByCallback {
400+ Err ( ClarityError :: AbortedByCallback {
401401 output : None ,
402402 assets_modified : Box :: new ( assets_modified) ,
403403 tx_events,
0 commit comments