mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-11 21:49:13 +00:00
Towards virtual tables.
This commit is contained in:
16
error.go
16
error.go
@@ -1,6 +1,7 @@
|
||||
package sqlite3
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -135,3 +136,18 @@ func (e ExtendedErrorCode) Temporary() bool {
|
||||
func (e ExtendedErrorCode) Timeout() bool {
|
||||
return e == BUSY_TIMEOUT
|
||||
}
|
||||
|
||||
func errorCode(err error, def ErrorCode) (code uint32) {
|
||||
var ecode ErrorCode
|
||||
var xcode xErrorCode
|
||||
switch {
|
||||
case errors.As(err, &xcode):
|
||||
return uint32(xcode)
|
||||
case errors.As(err, &ecode):
|
||||
return uint32(ecode)
|
||||
}
|
||||
if err != nil {
|
||||
return uint32(def)
|
||||
}
|
||||
return _OK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user