-
Notifications
You must be signed in to change notification settings - Fork 39
/
exception.go
79 lines (66 loc) · 3.36 KB
/
exception.go
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright 2017~2022 The Bottos Authors
// This file is part of the Bottos Chain library.
// Created by Rocket Core Team of Bottos.
// This program is free software: you can distribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Bottos. If not, see <http://www.gnu.org/licenses/>.
// Copyright 2017 The go-interpreter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
* file description: const push
* @Author: Stewart Li
* @Date: 2017-12-07
* @Last Modified by:
* @Last Modified time:
*/
package exec
import (
"errors"
)
type TYPE uint32
const (
VM_NOERROR TYPE = iota
VM_ERROR_OUT_OF_MEMORY
VM_ERROR_INVALID_PARAMETER_COUNT
VM_ERROR_FAIL_EXECUTE_ENVFUNC
VM_ERROR_FAIL_STORAGE_MEMORY
)
const (
VM_NULL = iota
)
const (
VM_FALSE = iota
VM_TRUE
)
var ERR_EOF = errors.New("EOF")
var ERR_STORE_METHOD = errors.New("*ERROR* failed to store the method name at the memory")
var ERR_STORE_PARAM = errors.New("*ERROR* failed to store the method arguments at the memory")
var ERR_STORE_MEMORY = errors.New("*ERROR* failed to storage data to memory")
var ERR_COPY_DATA = errors.New("*ERROR* failed to copy data")
var ERR_GET_STORE_POS = errors.New("*ERROR* failed to get the position of data")
var ERR_CREATE_VM = errors.New("*ERROR* failed to create a new VM instance")
var ERR_GET_VM = errors.New("*ERROR* failed to get a VM instance from memory")
var ERR_FIND_VM_METHOD = errors.New("*ERROR* failed to find the method from the wasm module")
var ERR_PARAM_COUNT = errors.New("*ERROR* parameters count is not right")
var ERR_UNSUPPORT_TYPE = errors.New("*ERROR* unsupport type")
var ERR_OUT_BOUNDS = errors.New("*ERROR* (array) index out of bounds")
var ERR_CALL_ENV_METHOD = errors.New("*ERROR* failed to call the env method")
var ERR_EMPTY_INVALID_PARAM = errors.New("*ERROR* empty parameter or invalid parameter")
var ERR_INVALID_WASM = errors.New("*ERROR* invalid wasm module")
var ERR_DATA_INDEX = errors.New("*ERROR* failed to get data index from memory")
var ERR_FINE_MAP = errors.New("*ERROR* the specified value can't be found by the key from the map")
var ERR_USED_POS = errors.New("*ERROR* the specified storage pos had been used")
// ErrMultipleLinearMemories is returned by (*VM).NewVM when the module
// has more then one entries in the linear memory space.
var ERR_MULTIPLE_LINEAR_MEMORIES = errors.New("*ERROR* more than one linear memories in module")
// ErrInvalidArgumentCount is returned by (*VM).ExecCode when an invalid
// number of arguments to the WebAssembly function are passed to it.
var ERR_INVALID_ARGUMENT_COUNT = errors.New("*ERROR* invalid number of arguments to function")