Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
ec9ab02f
Commit
ec9ab02f
authored
Jan 13, 2011
by
Leigh B Stoller
Browse files
Insert the default error string from the STRINGS table, when its an
error and no output is provided. Helpful.
parent
372d0bce
Changes
1
Hide whitespace changes
Inline
Side-by-side
protogeni/xmlrpc/GeniResponse.pm
View file @
ec9ab02f
#!/usr/bin/perl -w
#
# GENIPUBLIC-COPYRIGHT
# Copyright (c) 2008-201
0
University of Utah and the Flux Group.
# Copyright (c) 2008-201
1
University of Utah and the Flux Group.
# All rights reserved.
#
# Perl code to access an XMLRPC server using http. Derived from the
...
...
@@ -72,9 +72,12 @@ my @GENIRESPONSE_STRINGS =
);
sub
GENIRESPONSE_STRING
($)
{
my
(
$
error
)
=
@_
;
my
(
$
code
)
=
@_
;
return
$GENIRESPONSE_STRINGS
[
$error
]
||
"
Unknown Error
$error
";
return
"
Unknown Error
$code
"
if
(
$code
<
0
||
$code
>
scalar
(
@GENIRESPONSE_STRINGS
));
return
$GENIRESPONSE_STRINGS
[
$code
];
}
#
...
...
@@ -103,8 +106,13 @@ sub new($$;$$)
{
my
(
$class
,
$code
,
$value
,
$output
)
=
@_
;
$output
=
""
if
(
!
defined
(
$output
));
if
(
!
defined
(
$output
))
{
$output
=
"";
# Unless its an error, then return standard error string.
if
(
$code
!=
GENIRESPONSE_SUCCESS
())
{
$output
=
GENIRESPONSE_STRING
(
$code
);
}
}
$value
=
0
if
(
!
defined
(
$value
));
...
...
@@ -119,8 +127,13 @@ sub Create($$;$$)
{
my
(
$class
,
$code
,
$value
,
$output
)
=
@_
;
$output
=
""
if
(
!
defined
(
$output
));
if
(
!
defined
(
$output
))
{
$output
=
"";
# Unless its an error, then return standard error string.
if
(
$code
!=
GENIRESPONSE_SUCCESS
())
{
$output
=
GENIRESPONSE_STRING
(
$code
);
}
}
$value
=
0
if
(
!
defined
(
$value
));
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment