Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
f448310e
Commit
f448310e
authored
Aug 26, 2015
by
Bas van Kervel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix console error handling
parent
abce0995
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
jeth.go
rpc/jeth.go
+5
-4
types.go
rpc/shared/types.go
+2
-4
No files found.
rpc/jeth.go
View file @
f448310e
...
@@ -44,11 +44,12 @@ func NewJeth(ethApi shared.EthereumApi, re *jsre.JSRE, client comms.EthereumClie
...
@@ -44,11 +44,12 @@ func NewJeth(ethApi shared.EthereumApi, re *jsre.JSRE, client comms.EthereumClie
}
}
func
(
self
*
Jeth
)
err
(
call
otto
.
FunctionCall
,
code
int
,
msg
string
,
id
interface
{})
(
response
otto
.
Value
)
{
func
(
self
*
Jeth
)
err
(
call
otto
.
FunctionCall
,
code
int
,
msg
string
,
id
interface
{})
(
response
otto
.
Value
)
{
errObj
:=
fmt
.
Sprintf
(
"{
\"
message
\"
:
\"
%s
\"
,
\"
code
\"
: %d}"
,
msg
,
code
)
m
:=
shared
.
NewRpcErrorResponse
(
id
,
shared
.
JsonRpcVersion
,
code
,
fmt
.
Errorf
(
msg
))
retResponse
:=
fmt
.
Sprintf
(
"ret_response = JSON.parse('{
\"
jsonrpc
\"
:
\"
%s
\"
,
\"
id
\"
: %v,
\"
error
\"
: %s}');"
,
shared
.
JsonRpcVersion
,
id
,
errObj
)
errObj
,
_
:=
json
.
Marshal
(
m
.
Error
)
errRes
,
_
:=
json
.
Marshal
(
m
)
call
.
Otto
.
Run
(
"ret_error = "
+
errObj
)
call
.
Otto
.
Run
(
"ret_error = "
+
string
(
errObj
)
)
res
,
_
:=
call
.
Otto
.
Run
(
retResponse
)
res
,
_
:=
call
.
Otto
.
Run
(
"ret_response = "
+
string
(
errRes
)
)
return
res
return
res
}
}
...
...
rpc/shared/types.go
View file @
f448310e
...
@@ -74,11 +74,9 @@ type ErrorObject struct {
...
@@ -74,11 +74,9 @@ type ErrorObject struct {
}
}
// Create RPC error response, this allows for custom error codes
// Create RPC error response, this allows for custom error codes
func
NewRpcErrorResponse
(
id
interface
{},
jsonrpcver
string
,
errCode
int
,
err
error
)
*
interface
{}
{
func
NewRpcErrorResponse
(
id
interface
{},
jsonrpcver
string
,
errCode
int
,
err
error
)
*
ErrorResponse
{
var
response
interface
{}
jsonerr
:=
&
ErrorObject
{
errCode
,
err
.
Error
()}
jsonerr
:=
&
ErrorObject
{
errCode
,
err
.
Error
()}
response
=
ErrorResponse
{
Jsonrpc
:
jsonrpcver
,
Id
:
id
,
Error
:
jsonerr
}
response
:
=
ErrorResponse
{
Jsonrpc
:
jsonrpcver
,
Id
:
id
,
Error
:
jsonerr
}
glog
.
V
(
logger
.
Detail
)
.
Infof
(
"Generated error response: %s"
,
response
)
glog
.
V
(
logger
.
Detail
)
.
Infof
(
"Generated error response: %s"
,
response
)
return
&
response
return
&
response
...
...
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