good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
309788de
Commit
309788de
authored
9 years ago
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
rpc: update the xeth over RPC API to use the success/failure messages
parent
f6367548
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rpc/xeth.go
+13
-5
13 additions, 5 deletions
rpc/xeth.go
with
13 additions
and
5 deletions
rpc/xeth.go
+
13
−
5
View file @
309788de
...
...
@@ -53,7 +53,7 @@ func (self *Xeth) Call(method string, params []interface{}) (map[string]interfac
Method
:
method
,
Params
:
data
,
}
// Send the request over and
process
the response
// Send the request over and
retrieve
the response
if
err
:=
self
.
client
.
Send
(
req
);
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -61,9 +61,17 @@ func (self *Xeth) Call(method string, params []interface{}) (map[string]interfac
if
err
!=
nil
{
return
nil
,
err
}
value
,
ok
:=
res
.
(
map
[
string
]
interface
{})
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"Invalid response type: have %v, want %v"
,
reflect
.
TypeOf
(
res
),
reflect
.
TypeOf
(
make
(
map
[
string
]
interface
{})))
// Ensure the response is valid, and extract the results
success
,
isSuccessResponse
:=
res
.
(
*
shared
.
SuccessResponse
)
failure
,
isFailureResponse
:=
res
.
(
*
shared
.
ErrorResponse
)
switch
{
case
isFailureResponse
:
return
nil
,
fmt
.
Errorf
(
"Method invocation failed: %v"
,
failure
.
Error
)
case
isSuccessResponse
:
return
success
.
Result
.
(
map
[
string
]
interface
{}),
nil
default
:
return
nil
,
fmt
.
Errorf
(
"Invalid response type: %v"
,
reflect
.
TypeOf
(
res
))
}
return
value
,
nil
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment