This repository was archived by the owner on Dec 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patherrors.h
54 lines (49 loc) · 1.77 KB
/
errors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include <limits>
#include <napi.h>
#include <string>
namespace SSVM {
namespace NAPI {
enum class ErrorType {
ExpectWasmFileOrBytecode,
ParseOptionsFailed,
UnknownBytecodeFormat,
UnsupportedArgumentType,
InvalidInputFormat,
LoadWasmFailed,
ValidateWasmFailed,
InstantiateWasmFailed,
ExecutionFailed,
BadMemoryAccess,
InitReactorFailed,
WasmBindgenMallocFailed,
WasmBindgenFreeFailed,
NAPIUnkownIntType
};
const std::map<ErrorType, std::string> ErrorMsgs = {
{ErrorType::ExpectWasmFileOrBytecode,
"Expected a Wasm file or a Wasm binary sequence."},
{ErrorType::ParseOptionsFailed, "Parse options failed."},
{ErrorType::UnknownBytecodeFormat, "Unknown bytecode format."},
{ErrorType::InvalidInputFormat,
"Input Wasm is not a valid Uint8Array or not a valid file path."},
{ErrorType::LoadWasmFailed,
"Wasm bytecode/file cannot be loaded correctly."},
{ErrorType::ValidateWasmFailed,
"Wasm bytecode/file failed at validation stage."},
{ErrorType::InstantiateWasmFailed,
"Wasm bytecode/file cannot be instantiated."},
{ErrorType::ExecutionFailed, "SSVM execution failed"},
{ErrorType::BadMemoryAccess,
"Access to forbidden memory address when retrieving address and "
"length of result data"},
{ErrorType::InitReactorFailed, "Initialize wasi reactor mode failed"},
{ErrorType::WasmBindgenMallocFailed,
"Failed to call wasm-bindgen helper function __wbindgen_malloc"},
{ErrorType::WasmBindgenFreeFailed,
"Failed to call wasm-bindgen helper function __wbindgen_free"},
{ErrorType::NAPIUnkownIntType,
"SSVM-Napi implementation error: unknown integer type"},
{ErrorType::UnsupportedArgumentType, "Unsupported argument type"}};
} // namespace NAPI
} // namespace SSVM