Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
3c36c34a
Commit
3c36c34a
authored
May 31, 2007
by
Donal McMullan
Browse files
Handle error responses from remote server more elegantly
parent
7dd3ad6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/api/xmlrpc/lib.php
View file @
3c36c34a
...
@@ -83,6 +83,18 @@ function get_public_key($uri, $application=null) {
...
@@ -83,6 +83,18 @@ function get_public_key($uri, $application=null) {
if
(
empty
(
$raw
))
{
if
(
empty
(
$raw
))
{
throw
new
XmlrpcClientException
(
'CURL connection failed'
);
throw
new
XmlrpcClientException
(
'CURL connection failed'
);
}
}
$response_code
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
$response_code_prefix
=
substr
(
$response_code
,
0
,
1
);
if
(
'2'
!=
$response_code_prefix
)
{
if
(
'4'
==
$response_code_prefix
)
{
throw
new
XmlrpcClientException
(
'Client error code: '
,
$response_code
);
}
elseif
(
'5'
==
$response_code_prefix
)
{
throw
new
XmlrpcClientException
(
'An error occurred at the remote server. Code: '
,
$response_code
);
}
}
$res
=
xmlrpc_decode
(
$raw
);
$res
=
xmlrpc_decode
(
$raw
);
curl_close
(
$ch
);
curl_close
(
$ch
);
...
...
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