1#![allow(non_camel_case_types)]
5#![allow(unused)]
6pub mod documentation;
7pub(crate) mod error;
8pub use error::CustomErrorMessage;
9pub use error::ICustomError;
10pub use error::IError;
11pub use error::IUnifiedError;
12pub use error::NamedError;
13pub(crate) mod identifier;
14pub use identifier::Identifier;
15pub use identifier::Identifying;
16pub use identifier::StructuredErrorCode;
17pub(crate) mod kind;
18pub use kind::Kind;
19pub mod packed;
20pub mod serialized;
21pub mod untyped;
22pub use crate::error::domains::ZksyncError;
23pub mod anvil_zksync {
24 pub use crate::error::domains::AnvilZksync as AnvilZksyncError;
25 pub use crate::error::domains::AnvilZksyncCode;
26 pub mod env {
27 pub use crate::error::definitions::AnvilEnvironment as AnvilEnvironmentError;
28 pub type AnvilEnvironmentResult<T> = core::result::Result<T, AnvilEnvironmentError>;
29 pub use crate::error::definitions::AnvilEnvironment::GenericError;
30 pub use crate::error::definitions::AnvilEnvironment::InvalidArguments;
31 pub use crate::error::definitions::AnvilEnvironment::LogFileAccessFailed;
32 pub use crate::error::definitions::AnvilEnvironment::LogFileWriteFailed;
33 pub use crate::error::definitions::AnvilEnvironment::ServerStartupFailed;
34 pub use crate::error::definitions::AnvilEnvironmentCode as ErrorCode;
35 #[macro_export]
36 macro_rules ! anvil_zksync_env_generic_error { ($ ($ arg : tt) *) => { zksync_error :: anvil_zksync :: env :: AnvilEnvironmentError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
37 pub use crate::anvil_zksync_env_generic_error as generic_error;
38 pub fn to_generic<T: std::fmt::Display>(err: T) -> AnvilEnvironmentError {
39 GenericError {
40 message: err.to_string(),
41 }
42 }
43 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::AnvilZksyncError {
44 super::AnvilZksyncError::AnvilEnvironment(GenericError {
45 message: err.to_string(),
46 })
47 }
48 }
49 pub mod gen {
50 pub use crate::error::definitions::AnvilGeneric as AnvilGenericError;
51 pub type AnvilGenericResult<T> = core::result::Result<T, AnvilGenericError>;
52 pub use crate::error::definitions::AnvilGeneric::GenericError;
53 pub use crate::error::definitions::AnvilGenericCode as ErrorCode;
54 #[macro_export]
55 macro_rules ! anvil_zksync_gen_generic_error { ($ ($ arg : tt) *) => { zksync_error :: anvil_zksync :: gen :: AnvilGenericError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
56 pub use crate::anvil_zksync_gen_generic_error as generic_error;
57 pub fn to_generic<T: std::fmt::Display>(err: T) -> AnvilGenericError {
58 GenericError {
59 message: err.to_string(),
60 }
61 }
62 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::AnvilZksyncError {
63 super::AnvilZksyncError::AnvilGeneric(GenericError {
64 message: err.to_string(),
65 })
66 }
67 }
68 pub mod node {
69 pub use crate::error::definitions::AnvilNode as AnvilNodeError;
70 pub type AnvilNodeResult<T> = core::result::Result<T, AnvilNodeError>;
71 pub use crate::error::definitions::AnvilNode::GenericError;
72 pub use crate::error::definitions::AnvilNode::SerializationError;
73 pub use crate::error::definitions::AnvilNode::TimestampBackwardsError;
74 pub use crate::error::definitions::AnvilNode::TransactionGasEstimationFailed;
75 pub use crate::error::definitions::AnvilNode::TransactionHalt;
76 pub use crate::error::definitions::AnvilNode::TransactionValidationFailed;
77 pub use crate::error::definitions::AnvilNodeCode as ErrorCode;
78 #[macro_export]
79 macro_rules ! anvil_zksync_node_generic_error { ($ ($ arg : tt) *) => { zksync_error :: anvil_zksync :: node :: AnvilNodeError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
80 pub use crate::anvil_zksync_node_generic_error as generic_error;
81 pub fn to_generic<T: std::fmt::Display>(err: T) -> AnvilNodeError {
82 GenericError {
83 message: err.to_string(),
84 }
85 }
86 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::AnvilZksyncError {
87 super::AnvilZksyncError::AnvilNode(GenericError {
88 message: err.to_string(),
89 })
90 }
91 }
92 pub mod gas_estim {
93 pub use crate::error::definitions::GasEstimation as GasEstimationError;
94 pub type GasEstimationResult<T> = core::result::Result<T, GasEstimationError>;
95 pub use crate::error::definitions::GasEstimation::ExceedsBlockGasLimit;
96 pub use crate::error::definitions::GasEstimation::ExceedsLimitForPublishedPubdata;
97 pub use crate::error::definitions::GasEstimation::GenericError;
98 pub use crate::error::definitions::GasEstimation::TransactionAlwaysHalts;
99 pub use crate::error::definitions::GasEstimation::TransactionAlwaysReverts;
100 pub use crate::error::definitions::GasEstimation::TransactionHalt;
101 pub use crate::error::definitions::GasEstimation::TransactionRevert;
102 pub use crate::error::definitions::GasEstimationCode as ErrorCode;
103 #[macro_export]
104 macro_rules ! anvil_zksync_gas_estim_generic_error { ($ ($ arg : tt) *) => { zksync_error :: anvil_zksync :: gas_estim :: GasEstimationError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
105 pub use crate::anvil_zksync_gas_estim_generic_error as generic_error;
106 pub fn to_generic<T: std::fmt::Display>(err: T) -> GasEstimationError {
107 GenericError {
108 message: err.to_string(),
109 }
110 }
111 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::AnvilZksyncError {
112 super::AnvilZksyncError::GasEstimation(GenericError {
113 message: err.to_string(),
114 })
115 }
116 }
117 pub mod halt {
118 pub use crate::error::definitions::Halt as HaltError;
119 pub type HaltResult<T> = core::result::Result<T, HaltError>;
120 pub use crate::error::definitions::Halt::BootloaderOutOfGas;
121 pub use crate::error::definitions::Halt::FailedBlockTimestampAssertion;
122 pub use crate::error::definitions::Halt::FailedToAppendTransactionToL2Block;
123 pub use crate::error::definitions::Halt::FailedToChargeFee;
124 pub use crate::error::definitions::Halt::FailedToMarkFactoryDependencies;
125 pub use crate::error::definitions::Halt::FailedToPublishCompressedBytecodes;
126 pub use crate::error::definitions::Halt::FailedToSetL2Block;
127 pub use crate::error::definitions::Halt::FromIsNotAnAccount;
128 pub use crate::error::definitions::Halt::GenericError;
129 pub use crate::error::definitions::Halt::InnerTxError;
130 pub use crate::error::definitions::Halt::MissingInvocationLimitReached;
131 pub use crate::error::definitions::Halt::NotEnoughGasProvided;
132 pub use crate::error::definitions::Halt::PayForTxFailed;
133 pub use crate::error::definitions::Halt::PaymasterValidationFailed;
134 pub use crate::error::definitions::Halt::PrePaymasterPreparationFailed;
135 pub use crate::error::definitions::Halt::TooBigGasLimit;
136 pub use crate::error::definitions::Halt::TracerCustom;
137 pub use crate::error::definitions::Halt::UnexpectedVMBehavior;
138 pub use crate::error::definitions::Halt::Unknown;
139 pub use crate::error::definitions::Halt::VMPanic;
140 pub use crate::error::definitions::Halt::ValidationFailed;
141 pub use crate::error::definitions::Halt::ValidationOutOfGas;
142 pub use crate::error::definitions::HaltCode as ErrorCode;
143 #[macro_export]
144 macro_rules ! anvil_zksync_halt_generic_error { ($ ($ arg : tt) *) => { zksync_error :: anvil_zksync :: halt :: HaltError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
145 pub use crate::anvil_zksync_halt_generic_error as generic_error;
146 pub fn to_generic<T: std::fmt::Display>(err: T) -> HaltError {
147 GenericError {
148 message: err.to_string(),
149 }
150 }
151 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::AnvilZksyncError {
152 super::AnvilZksyncError::Halt(GenericError {
153 message: err.to_string(),
154 })
155 }
156 }
157 pub mod revert {
158 pub use crate::error::definitions::Revert as RevertError;
159 pub type RevertResult<T> = core::result::Result<T, RevertError>;
160 pub use crate::error::definitions::Revert::General;
161 pub use crate::error::definitions::Revert::GenericError;
162 pub use crate::error::definitions::Revert::InnerTxError;
163 pub use crate::error::definitions::Revert::Unknown;
164 pub use crate::error::definitions::Revert::VmError;
165 pub use crate::error::definitions::RevertCode as ErrorCode;
166 #[macro_export]
167 macro_rules ! anvil_zksync_revert_generic_error { ($ ($ arg : tt) *) => { zksync_error :: anvil_zksync :: revert :: RevertError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
168 pub use crate::anvil_zksync_revert_generic_error as generic_error;
169 pub fn to_generic<T: std::fmt::Display>(err: T) -> RevertError {
170 GenericError {
171 message: err.to_string(),
172 }
173 }
174 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::AnvilZksyncError {
175 super::AnvilZksyncError::Revert(GenericError {
176 message: err.to_string(),
177 })
178 }
179 }
180 pub mod state {
181 pub use crate::error::definitions::StateLoader as StateLoaderError;
182 pub type StateLoaderResult<T> = core::result::Result<T, StateLoaderError>;
183 pub use crate::error::definitions::StateLoader::GenericError;
184 pub use crate::error::definitions::StateLoader::LoadEmptyState;
185 pub use crate::error::definitions::StateLoader::LoadingStateOverExistingState;
186 pub use crate::error::definitions::StateLoader::StateDecompression;
187 pub use crate::error::definitions::StateLoader::StateDeserialization;
188 pub use crate::error::definitions::StateLoader::StateFileAccess;
189 pub use crate::error::definitions::StateLoader::UnknownStateVersion;
190 pub use crate::error::definitions::StateLoaderCode as ErrorCode;
191 #[macro_export]
192 macro_rules ! anvil_zksync_state_generic_error { ($ ($ arg : tt) *) => { zksync_error :: anvil_zksync :: state :: StateLoaderError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
193 pub use crate::anvil_zksync_state_generic_error as generic_error;
194 pub fn to_generic<T: std::fmt::Display>(err: T) -> StateLoaderError {
195 GenericError {
196 message: err.to_string(),
197 }
198 }
199 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::AnvilZksyncError {
200 super::AnvilZksyncError::StateLoader(GenericError {
201 message: err.to_string(),
202 })
203 }
204 }
205 pub mod tx_invalid {
206 pub use crate::error::definitions::TransactionValidation as TransactionValidationError;
207 pub type TransactionValidationResult<T> =
208 core::result::Result<T, TransactionValidationError>;
209 pub use crate::error::definitions::TransactionValidation::GasPerPubdataLimit;
210 pub use crate::error::definitions::TransactionValidation::GenericError;
211 pub use crate::error::definitions::TransactionValidation::InvalidGasLimit;
212 pub use crate::error::definitions::TransactionValidation::MaxFeePerGasTooLow;
213 pub use crate::error::definitions::TransactionValidation::MaxPriorityFeeGreaterThanMaxFee;
214 pub use crate::error::definitions::TransactionValidationCode as ErrorCode;
215 #[macro_export]
216 macro_rules ! anvil_zksync_tx_invalid_generic_error { ($ ($ arg : tt) *) => { zksync_error :: anvil_zksync :: tx_invalid :: TransactionValidationError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
217 pub use crate::anvil_zksync_tx_invalid_generic_error as generic_error;
218 pub fn to_generic<T: std::fmt::Display>(err: T) -> TransactionValidationError {
219 GenericError {
220 message: err.to_string(),
221 }
222 }
223 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::AnvilZksyncError {
224 super::AnvilZksyncError::TransactionValidation(GenericError {
225 message: err.to_string(),
226 })
227 }
228 }
229}
230pub mod compiler {
231 pub use crate::error::domains::Compiler as CompilerError;
232 pub use crate::error::domains::CompilerCode;
233 pub mod llvm_evm {
234 pub use crate::error::definitions::LLVM_EVM as LLVM_EVMError;
235 pub type LLVM_EVMResult<T> = core::result::Result<T, LLVM_EVMError>;
236 pub use crate::error::definitions::LLVM_EVMCode as ErrorCode;
237 pub use crate::error::definitions::LLVM_EVM::GenericError;
238 #[macro_export]
239 macro_rules ! compiler_llvm_evm_generic_error { ($ ($ arg : tt) *) => { zksync_error :: compiler :: llvm_evm :: LLVM_EVMError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
240 pub use crate::compiler_llvm_evm_generic_error as generic_error;
241 pub fn to_generic<T: std::fmt::Display>(err: T) -> LLVM_EVMError {
242 GenericError {
243 message: err.to_string(),
244 }
245 }
246 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::CompilerError {
247 super::CompilerError::LLVM_EVM(GenericError {
248 message: err.to_string(),
249 })
250 }
251 }
252 pub mod llvm_era {
253 pub use crate::error::definitions::LLVM_Era as LLVM_EraError;
254 pub type LLVM_EraResult<T> = core::result::Result<T, LLVM_EraError>;
255 pub use crate::error::definitions::LLVM_Era::GenericError;
256 pub use crate::error::definitions::LLVM_EraCode as ErrorCode;
257 #[macro_export]
258 macro_rules ! compiler_llvm_era_generic_error { ($ ($ arg : tt) *) => { zksync_error :: compiler :: llvm_era :: LLVM_EraError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
259 pub use crate::compiler_llvm_era_generic_error as generic_error;
260 pub fn to_generic<T: std::fmt::Display>(err: T) -> LLVM_EraError {
261 GenericError {
262 message: err.to_string(),
263 }
264 }
265 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::CompilerError {
266 super::CompilerError::LLVM_Era(GenericError {
267 message: err.to_string(),
268 })
269 }
270 }
271 pub mod solc {
272 pub use crate::error::definitions::Solc as SolcError;
273 pub type SolcResult<T> = core::result::Result<T, SolcError>;
274 pub use crate::error::definitions::Solc::GenericError;
275 pub use crate::error::definitions::SolcCode as ErrorCode;
276 #[macro_export]
277 macro_rules ! compiler_solc_generic_error { ($ ($ arg : tt) *) => { zksync_error :: compiler :: solc :: SolcError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
278 pub use crate::compiler_solc_generic_error as generic_error;
279 pub fn to_generic<T: std::fmt::Display>(err: T) -> SolcError {
280 GenericError {
281 message: err.to_string(),
282 }
283 }
284 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::CompilerError {
285 super::CompilerError::Solc(GenericError {
286 message: err.to_string(),
287 })
288 }
289 }
290 pub mod solc_fork {
291 pub use crate::error::definitions::SolcFork as SolcForkError;
292 pub type SolcForkResult<T> = core::result::Result<T, SolcForkError>;
293 pub use crate::error::definitions::SolcFork::GenericError;
294 pub use crate::error::definitions::SolcForkCode as ErrorCode;
295 #[macro_export]
296 macro_rules ! compiler_solc_fork_generic_error { ($ ($ arg : tt) *) => { zksync_error :: compiler :: solc_fork :: SolcForkError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
297 pub use crate::compiler_solc_fork_generic_error as generic_error;
298 pub fn to_generic<T: std::fmt::Display>(err: T) -> SolcForkError {
299 GenericError {
300 message: err.to_string(),
301 }
302 }
303 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::CompilerError {
304 super::CompilerError::SolcFork(GenericError {
305 message: err.to_string(),
306 })
307 }
308 }
309 pub mod zksolc {
310 pub use crate::error::definitions::Zksolc as ZksolcError;
311 pub type ZksolcResult<T> = core::result::Result<T, ZksolcError>;
312 pub use crate::error::definitions::Zksolc::GenericError;
313 pub use crate::error::definitions::ZksolcCode as ErrorCode;
314 #[macro_export]
315 macro_rules ! compiler_zksolc_generic_error { ($ ($ arg : tt) *) => { zksync_error :: compiler :: zksolc :: ZksolcError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
316 pub use crate::compiler_zksolc_generic_error as generic_error;
317 pub fn to_generic<T: std::fmt::Display>(err: T) -> ZksolcError {
318 GenericError {
319 message: err.to_string(),
320 }
321 }
322 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::CompilerError {
323 super::CompilerError::Zksolc(GenericError {
324 message: err.to_string(),
325 })
326 }
327 }
328 pub mod zkvyper {
329 pub use crate::error::definitions::Zkvyper as ZkvyperError;
330 pub type ZkvyperResult<T> = core::result::Result<T, ZkvyperError>;
331 pub use crate::error::definitions::Zkvyper::GenericError;
332 pub use crate::error::definitions::ZkvyperCode as ErrorCode;
333 #[macro_export]
334 macro_rules ! compiler_zkvyper_generic_error { ($ ($ arg : tt) *) => { zksync_error :: compiler :: zkvyper :: ZkvyperError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
335 pub use crate::compiler_zkvyper_generic_error as generic_error;
336 pub fn to_generic<T: std::fmt::Display>(err: T) -> ZkvyperError {
337 GenericError {
338 message: err.to_string(),
339 }
340 }
341 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::CompilerError {
342 super::CompilerError::Zkvyper(GenericError {
343 message: err.to_string(),
344 })
345 }
346 }
347}
348pub mod core {
349 pub use crate::error::domains::Core as CoreError;
350 pub use crate::error::domains::CoreCode;
351 pub mod api {
352 pub use crate::error::definitions::API as APIError;
353 pub type APIResult<T> = core::result::Result<T, APIError>;
354 pub use crate::error::definitions::APICode as ErrorCode;
355 pub use crate::error::definitions::API::GenericError;
356 #[macro_export]
357 macro_rules ! core_api_generic_error { ($ ($ arg : tt) *) => { zksync_error :: core :: api :: APIError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
358 pub use crate::core_api_generic_error as generic_error;
359 pub fn to_generic<T: std::fmt::Display>(err: T) -> APIError {
360 GenericError {
361 message: err.to_string(),
362 }
363 }
364 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::CoreError {
365 super::CoreError::API(GenericError {
366 message: err.to_string(),
367 })
368 }
369 }
370 pub mod eravm {
371 pub use crate::error::definitions::EraVM as EraVMError;
372 pub type EraVMResult<T> = core::result::Result<T, EraVMError>;
373 pub use crate::error::definitions::EraVM::GenericError;
374 pub use crate::error::definitions::EraVMCode as ErrorCode;
375 #[macro_export]
376 macro_rules ! core_eravm_generic_error { ($ ($ arg : tt) *) => { zksync_error :: core :: eravm :: EraVMError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
377 pub use crate::core_eravm_generic_error as generic_error;
378 pub fn to_generic<T: std::fmt::Display>(err: T) -> EraVMError {
379 GenericError {
380 message: err.to_string(),
381 }
382 }
383 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::CoreError {
384 super::CoreError::EraVM(GenericError {
385 message: err.to_string(),
386 })
387 }
388 }
389 pub mod exec {
390 pub use crate::error::definitions::ExecutionPlatform as ExecutionPlatformError;
391 pub type ExecutionPlatformResult<T> = core::result::Result<T, ExecutionPlatformError>;
392 pub use crate::error::definitions::ExecutionPlatform::GenericError;
393 pub use crate::error::definitions::ExecutionPlatformCode as ErrorCode;
394 #[macro_export]
395 macro_rules ! core_exec_generic_error { ($ ($ arg : tt) *) => { zksync_error :: core :: exec :: ExecutionPlatformError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
396 pub use crate::core_exec_generic_error as generic_error;
397 pub fn to_generic<T: std::fmt::Display>(err: T) -> ExecutionPlatformError {
398 GenericError {
399 message: err.to_string(),
400 }
401 }
402 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::CoreError {
403 super::CoreError::ExecutionPlatform(GenericError {
404 message: err.to_string(),
405 })
406 }
407 }
408 pub mod seq {
409 pub use crate::error::definitions::Sequencer as SequencerError;
410 pub type SequencerResult<T> = core::result::Result<T, SequencerError>;
411 pub use crate::error::definitions::Sequencer::GenericError;
412 pub use crate::error::definitions::Sequencer::GenericSequencerError;
413 pub use crate::error::definitions::SequencerCode as ErrorCode;
414 #[macro_export]
415 macro_rules ! core_seq_generic_error { ($ ($ arg : tt) *) => { zksync_error :: core :: seq :: SequencerError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
416 pub use crate::core_seq_generic_error as generic_error;
417 pub fn to_generic<T: std::fmt::Display>(err: T) -> SequencerError {
418 GenericError {
419 message: err.to_string(),
420 }
421 }
422 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::CoreError {
423 super::CoreError::Sequencer(GenericError {
424 message: err.to_string(),
425 })
426 }
427 }
428}
429pub mod foundry {
430 pub use crate::error::domains::Foundry as FoundryError;
431 pub use crate::error::domains::FoundryCode;
432 pub mod upstream {
433 pub use crate::error::definitions::FoundryUpstream as FoundryUpstreamError;
434 pub type FoundryUpstreamResult<T> = core::result::Result<T, FoundryUpstreamError>;
435 pub use crate::error::definitions::FoundryUpstream::GenericError;
436 pub use crate::error::definitions::FoundryUpstreamCode as ErrorCode;
437 #[macro_export]
438 macro_rules ! foundry_upstream_generic_error { ($ ($ arg : tt) *) => { zksync_error :: foundry :: upstream :: FoundryUpstreamError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
439 pub use crate::foundry_upstream_generic_error as generic_error;
440 pub fn to_generic<T: std::fmt::Display>(err: T) -> FoundryUpstreamError {
441 GenericError {
442 message: err.to_string(),
443 }
444 }
445 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::FoundryError {
446 super::FoundryError::FoundryUpstream(GenericError {
447 message: err.to_string(),
448 })
449 }
450 }
451 pub mod zksync {
452 pub use crate::error::definitions::FoundryZksync as FoundryZksyncError;
453 pub type FoundryZksyncResult<T> = core::result::Result<T, FoundryZksyncError>;
454 pub use crate::error::definitions::FoundryZksync::GenericError;
455 pub use crate::error::definitions::FoundryZksyncCode as ErrorCode;
456 #[macro_export]
457 macro_rules ! foundry_zksync_generic_error { ($ ($ arg : tt) *) => { zksync_error :: foundry :: zksync :: FoundryZksyncError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
458 pub use crate::foundry_zksync_generic_error as generic_error;
459 pub fn to_generic<T: std::fmt::Display>(err: T) -> FoundryZksyncError {
460 GenericError {
461 message: err.to_string(),
462 }
463 }
464 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::FoundryError {
465 super::FoundryError::FoundryZksync(GenericError {
466 message: err.to_string(),
467 })
468 }
469 }
470}
471pub mod hardhat {
472 pub use crate::error::domains::Hardhat as HardhatError;
473 pub use crate::error::domains::HardhatCode;
474 pub mod upstream {
475 pub use crate::error::definitions::HardhatUpstream as HardhatUpstreamError;
476 pub type HardhatUpstreamResult<T> = core::result::Result<T, HardhatUpstreamError>;
477 pub use crate::error::definitions::HardhatUpstream::GenericError;
478 pub use crate::error::definitions::HardhatUpstreamCode as ErrorCode;
479 #[macro_export]
480 macro_rules ! hardhat_upstream_generic_error { ($ ($ arg : tt) *) => { zksync_error :: hardhat :: upstream :: HardhatUpstreamError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
481 pub use crate::hardhat_upstream_generic_error as generic_error;
482 pub fn to_generic<T: std::fmt::Display>(err: T) -> HardhatUpstreamError {
483 GenericError {
484 message: err.to_string(),
485 }
486 }
487 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::HardhatError {
488 super::HardhatError::HardhatUpstream(GenericError {
489 message: err.to_string(),
490 })
491 }
492 }
493 pub mod zksync {
494 pub use crate::error::definitions::HardhatZksync as HardhatZksyncError;
495 pub type HardhatZksyncResult<T> = core::result::Result<T, HardhatZksyncError>;
496 pub use crate::error::definitions::HardhatZksync::GenericError;
497 pub use crate::error::definitions::HardhatZksyncCode as ErrorCode;
498 #[macro_export]
499 macro_rules ! hardhat_zksync_generic_error { ($ ($ arg : tt) *) => { zksync_error :: hardhat :: zksync :: HardhatZksyncError :: GenericError { message : format ! ($ ($ arg) *) } } ; }
500 pub use crate::hardhat_zksync_generic_error as generic_error;
501 pub fn to_generic<T: std::fmt::Display>(err: T) -> HardhatZksyncError {
502 GenericError {
503 message: err.to_string(),
504 }
505 }
506 pub fn to_domain<T: std::fmt::Display>(err: T) -> super::HardhatError {
507 super::HardhatError::HardhatZksync(GenericError {
508 message: err.to_string(),
509 })
510 }
511 }
512}