@@ -28,75 +28,69 @@ pub type Result<T> = std::result::Result<T, Error>;
2828#[ derive( Debug , thiserror:: Error ) ]
2929#[ allow( missing_docs) ]
3030pub enum Error {
31- /// Unserializable Data
3231 #[ error( "Unserializable data encountered" ) ]
3332 InvalidData ( #[ from] sp_serializer:: Error ) ,
34- /// Trap occurred during execution
33+
3534 #[ error( transparent) ]
3635 Trap ( #[ from] wasmi:: Trap ) ,
37- /// Wasmi loading/instantiating error
36+
3837 #[ error( transparent) ]
3938 Wasmi ( #[ from] wasmi:: Error ) ,
40- /// Error in the API. Parameter is an error message.
39+
4140 #[ error( "API Error: {0}" ) ]
4241 ApiError ( String ) ,
43- /// Method is not found
42+
4443 #[ error( "Method not found: '{0}'" ) ]
4544 MethodNotFound ( String ) ,
46- /// Code is invalid (expected single byte)
47- #[ error( "Invalid Code: '{0}'" ) ]
45+
46+ #[ error( "Invalid Code (expected single byte) : '{0}'" ) ]
4847 InvalidCode ( String ) ,
49- /// Could not get runtime version.
48+
5049 #[ error( "On-chain runtime does not specify version" ) ]
5150 VersionInvalid ,
52- /// Externalities have failed.
51+
5352 #[ error( "Externalities error" ) ]
5453 Externalities ,
55- /// Invalid index.
54+
5655 #[ error( "Invalid index provided" ) ]
5756 InvalidIndex ,
58- /// Invalid return type.
57+
5958 #[ error( "Invalid type returned (should be u64)" ) ]
6059 InvalidReturn ,
61- /// Runtime failed.
60+
6261 #[ error( "Runtime error" ) ]
6362 Runtime ,
64- /// Runtime panicked.
63+
6564 #[ error( "Runtime panicked: {0}" ) ]
6665 RuntimePanicked ( String ) ,
67- /// Invalid memory reference.
66+
6867 #[ error( "Invalid memory reference" ) ]
6968 InvalidMemoryReference ,
70- /// The runtime must provide a global named `__heap_base` of type i32 for specifying where the
71- /// allocator is allowed to place its data.
72- #[ error( "The runtime doesn't provide a global named `__heap_base`" ) ]
69+
70+ #[ error( "The runtime doesn't provide a global named `__heap_base` of type `i32`" ) ]
7371 HeapBaseNotFoundOrInvalid ,
74- /// The runtime WebAssembly module is not allowed to have the `start` function.
75- #[ error( "The runtime has the `start` function" ) ]
72+
73+ #[ error( "The runtime must not have the `start` function defined " ) ]
7674 RuntimeHasStartFn ,
77- /// Some other error occurred
75+
7876 #[ error( "Other: {0}" ) ]
7977 Other ( String ) ,
80- /// Some error occurred in the allocator
81- #[ error( "Allocation Error" ) ]
78+
79+ #[ error( transparent ) ]
8280 Allocator ( #[ from] sp_allocator:: Error ) ,
83- /// Execution of a host function failed.
81+
8482 #[ error( "Host function {0} execution failed with: {1}" ) ]
8583 FunctionExecution ( String , String ) ,
86- /// No table is present.
87- ///
88- /// Call was requested that requires table but none was present in the instance.
84+
8985 #[ error( "No table exported by wasm blob" ) ]
9086 NoTable ,
91- /// No table entry is present.
92- ///
93- /// Call was requested that requires specific entry in the table to be present.
87+
9488 #[ error( "No table entry with index {0} in wasm blob exported table" ) ]
9589 NoTableEntryWithIndex ( u32 ) ,
96- /// Table entry is not a function.
90+
9791 #[ error( "Table element with index {0} is not a function in wasm blob exported table" ) ]
9892 TableElementIsNotAFunction ( u32 ) ,
99- /// Function in table is null and thus cannot be called.
93+
10094 #[ error( "Table entry with index {0} in wasm blob is null" ) ]
10195 FunctionRefIsNull ( u32 ) ,
10296
0 commit comments