Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
4ac48f08
Commit
4ac48f08
authored
Feb 26, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 547852: Make the JSON-RPC interface return the correct error format to
JSON-RPC 1.0 clients. r=dkl, a=mkanat
parent
65255e8c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
Error.pm
Bugzilla/Error.pm
+3
-1
JSONRPC.pm
Bugzilla/WebService/Server/JSONRPC.pm
+10
-3
No files found.
Bugzilla/Error.pm
View file @
4ac48f08
...
...
@@ -124,7 +124,9 @@ sub _throw_error {
# higher than 999, but we do this to avoid conflicts with
# the internal JSON::RPC error codes.
$server
->
raise_error
(
code
=>
100000
+
$code
,
message
=>
$message
);
message
=>
$message
,
id
=>
$server
->
{
_bz_request_id
},
version
=>
$server
->
version
);
# We die with no message. JSON::RPC checks raise_error before
# it checks $@, so it returns the proper error.
die
;
...
...
Bugzilla/WebService/Server/JSONRPC.pm
View file @
4ac48f08
...
...
@@ -35,8 +35,6 @@ sub new {
Bugzilla
->
_json_server
(
$self
);
$self
->
dispatch
(
WS_DISPATCH
);
$self
->
return_die_message
(
1
);
# Default to JSON-RPC 1.0
$self
->
version
(
0
);
return
$self
;
}
...
...
@@ -95,6 +93,15 @@ sub datetime_format {
return
$iso_datetime
;
}
# Store the ID of the current call, because Bugzilla::Error will need it.
sub
_handle
{
my
$self
=
shift
;
my
(
$obj
)
=
@_
;
$self
->
{
_bz_request_id
}
=
$obj
->
{
id
};
return
$self
->
SUPER::
_handle
(
@_
);
}
# Make all error messages returned by JSON::RPC go into the 100000
# range, and bring down all our errors into the normal range.
sub
_error
{
...
...
@@ -116,7 +123,7 @@ sub _error {
# We want to always send the JSON-RPC 1.1 error format, although
# If we're not in JSON-RPC 1.1, we don't need the silly "name" parameter.
if
(
!
$self
->
version
)
{
if
(
!
$self
->
version
or
$self
->
version
ne
'1.1'
)
{
my
$object
=
$self
->
json
->
decode
(
$json
);
my
$message
=
$object
->
{
error
};
# Just assure that future versions of JSON::RPC don't change the
...
...
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