mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-05-01 17:57:58 +00:00
packing errors also
This commit is contained in:
+1
-1
@@ -24,5 +24,5 @@ pub use optimizer::{optimize, Error as OptimizerError};
|
||||
pub use gas::inject_gas_counter;
|
||||
pub use logger::init_log;
|
||||
pub use ext::{externalize, externalize_mem, underscore_funcs, ununderscore_funcs, shrink_unknown_stack};
|
||||
pub use pack::pack_instance;
|
||||
pub use pack::{pack_instance, Error as PackingError};
|
||||
pub use runtime_type::inject_runtime_type;
|
||||
|
||||
+16
-1
@@ -1,3 +1,4 @@
|
||||
use std::fmt;
|
||||
use parity_wasm::elements::{
|
||||
self, Section, Opcode, DataSegment, InitExpr, Internal, External,
|
||||
ImportCountType,
|
||||
@@ -19,10 +20,24 @@ pub enum Error {
|
||||
InvalidCreateSignature,
|
||||
NoCreateSymbol,
|
||||
InvalidCreateMember,
|
||||
NoRetImported,
|
||||
NoImportSection,
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
Error::MalformedModule => write!(f, "Module internal references are inconsistent"),
|
||||
Error::NoTypeSection => write!(f, "No type section in the module"),
|
||||
Error::NoExportSection => write!(f, "No export section in the module"),
|
||||
Error::NoCodeSection => write!(f, "No code section inthe module"),
|
||||
Error::InvalidCreateSignature => write!(f, "Exported symbol `deploy` has invalid signature, should be () -> ()"),
|
||||
Error::InvalidCreateMember => write!(f, "Exported symbol `deploy` should be a function"),
|
||||
Error::NoCreateSymbol => write!(f, "No exported `deploy` symbol"),
|
||||
Error::NoImportSection => write!(f, "No import section in the module"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// If module has an exported "_create" function we want to pack it into "constructor".
|
||||
/// `raw_module` is the actual contract code
|
||||
/// `ctor_module` is the constructor which should return `raw_module`
|
||||
|
||||
Reference in New Issue
Block a user