Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
d4d1704c
Commit
d4d1704c
authored
Jul 09, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b387162a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
go/zodb/storage/zeo/zeo.go
go/zodb/storage/zeo/zeo.go
+23
-7
No files found.
go/zodb/storage/zeo/zeo.go
View file @
d4d1704c
...
@@ -182,7 +182,7 @@ func (r rpc) call(ctx context.Context, argv ...interface{}) (interface{}, error)
...
@@ -182,7 +182,7 @@ func (r rpc) call(ctx context.Context, argv ...interface{}) (interface{}, error)
//
//
// well-known exceptions are mapped to corresponding well-known errors - e.g.
// well-known exceptions are mapped to corresponding well-known errors - e.g.
// POSKeyError -> zodb.NoObjectError, and rest are returned wrapper into rpcExcept.
// POSKeyError -> zodb.NoObjectError, and rest are returned wrapper into rpcExcept.
func
(
r
rpc
)
excError
(
exc
string
,
argv
[]
interface
{}
)
error
{
func
(
r
rpc
)
excError
(
exc
string
,
argv
tuple
)
error
{
// translate well-known exceptions
// translate well-known exceptions
switch
exc
{
switch
exc
{
case
"ZODB.POSException.POSKeyError"
:
case
"ZODB.POSException.POSKeyError"
:
...
@@ -208,16 +208,14 @@ func (r rpc) excError(exc string, argv []interface{}) error {
...
@@ -208,16 +208,14 @@ func (r rpc) excError(exc string, argv []interface{}) error {
// zeo5Error decodes arg of reply with msgExcept flag set and returns
// zeo5Error decodes arg of reply with msgExcept flag set and returns
// corresponding error.
// corresponding error.
func
(
r
rpc
)
zeo5Error
(
arg
interface
{})
error
{
func
(
r
rpc
)
zeo5Error
(
arg
interface
{})
error
{
// XXX check r.zl.encoding == 'Z' before using pickles?
// ('type', (arg1, arg2, arg3, ...))
// ('type', (arg1, arg2, arg3, ...))
texc
,
ok
:=
arg
.
(
pickle
.
Tuple
)
texc
,
ok
:=
r
.
zl
.
asTuple
(
arg
)
if
!
ok
||
len
(
texc
)
!=
2
{
if
!
ok
||
len
(
texc
)
!=
2
{
return
r
.
ereplyf
(
"except5: got %#v; expect 2-tuple"
,
arg
)
return
r
.
ereplyf
(
"except5: got %#v; expect 2-tuple"
,
arg
)
}
}
exc
,
ok1
:=
texc
[
0
]
.
(
string
)
exc
,
ok1
:=
r
.
zl
.
asString
(
texc
[
0
]
)
argv
,
ok2
:=
texc
[
1
]
.
(
pickle
.
Tuple
)
argv
,
ok2
:=
r
.
zl
.
asTuple
(
texc
[
1
]
)
if
!
(
ok1
&&
ok2
)
{
if
!
(
ok1
&&
ok2
)
{
return
r
.
ereplyf
(
"except5: got (%T, %T); expect (str, tuple)"
,
texc
...
)
return
r
.
ereplyf
(
"except5: got (%T, %T); expect (str, tuple)"
,
texc
...
)
}
}
...
@@ -286,7 +284,7 @@ func (r rpc) zeo4Error(arg interface{}) error {
...
@@ -286,7 +284,7 @@ func (r rpc) zeo4Error(arg interface{}) error {
argv
=
args
argv
=
args
}
}
return
r
.
excError
(
exc
,
argv
)
return
r
.
excError
(
exc
,
tuple
(
argv
))
// XXX don't cast?
}
}
// isPyExceptClass returns whether klass represents python exception
// isPyExceptClass returns whether klass represents python exception
...
@@ -530,3 +528,21 @@ func (zl *zLink) asBytes(xb interface{}) ([]byte, bool) {
...
@@ -530,3 +528,21 @@ func (zl *zLink) asBytes(xb interface{}) ([]byte, bool) {
return
b
,
ok
return
b
,
ok
}
}
}
}
// asString tries to decode object as string.
func
(
zl
*
zLink
)
asString
(
xs
interface
{})
(
string
,
bool
)
{
switch
zl
.
encoding
{
default
:
panic
(
"bug"
)
case
'Z'
:
// pickle: str
s
,
ok
:=
xs
.
(
string
)
return
s
,
ok
case
'M'
:
// msgpack: bin XXX ZEO/py sends strings as bin
b
,
ok
:=
xs
.
([]
byte
)
return
string
(
b
),
ok
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment