From d0f2c8fac94f6917e4e997fd0b236d4de36e41d1 Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Thu, 11 Apr 2019 18:06:49 +0800 Subject: core: vm: sqlvm: errors: add severity field In order to report messages other than errors, we are going to reuse the error struct to store non-error messages, such as warnings and notes. We add a new field to distinguish between error and non-error messages. This field is not a part of SQLVM ABI, so non-error messages should never be returned to the caller of the contract. The zero value of severity is 'error'. Code which doesn't set this field should keep working because 'error' was the only use case. --- core/vm/sqlvm/runtime/runtime.go | 1 + 1 file changed, 1 insertion(+) (limited to 'core/vm/sqlvm/runtime') diff --git a/core/vm/sqlvm/runtime/runtime.go b/core/vm/sqlvm/runtime/runtime.go index 3b6d49a72..401b203db 100644 --- a/core/vm/sqlvm/runtime/runtime.go +++ b/core/vm/sqlvm/runtime/runtime.go @@ -19,6 +19,7 @@ func Run(stateDB vm.StateDB, ins []Instruction, registers []*Operand) (ret []byt err = se.Error{ Position: in.Position, Code: errCode.(se.ErrorCode), + Severity: se.ErrorSeverityError, Category: se.ErrorCategoryRuntime, } return nil, err -- cgit v1.2.3