Non-descriptive error messages

8 views
Skip to first unread message

sysprv

unread,
Oct 2, 2008, 5:55:21 PM10/2/08
to Sleep Developers
Hi,

Here's the scenario I've got:

connect.sl has a sub named jmx_connect.
jcdinfo.sl includes connect.sl, and calls jmx_connect.

If jmx_connect can be run correctly, all is ok.
However, if jmx_connect has problems like in the code below (required
class JMXServiceURL not imported),

import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
# import javax.management.remote.JMXServiceURL;

sub jmx_connect {
local('$conn $creds %env');
$creds = cast(@("Administrator", "test123"), ^String);
%env[ [JMXConnector CREDENTIALS] ] = $creds;
$conn = [JMXConnectorFactory connect:
[new JMXServiceURL: "service:jmx:rmi:///jndi/rmi://localhost:9878/
jmxrmi"], %env];
return $conn;
}


... running jcdinfo.sl prints:

D:\scripts\sleep>java -jar sleep.jar jcdinfo.sl
Warning: Attempted to call non-existent function &jmx_connect at
jcdinfo.sl:10
Warning: Attempted to call a non-static method on a null reference at
jcdinfo.sl:12
Warning: Attempted to call a non-static method on a null reference at
jmxbean.sl:7
Warning: Attempted to call a non-static method on a null reference at
jmxbean.sl:9
Warning: Attempted to use foreach on non-array: '' at jmxbean.sl:9
Warning: Attempted to call a non-static method on a null reference at
jmxbean.sl:19
Warning: Attempted to call a non-static method on a null reference at
jmxbean.sl:21
Warning: Attempted to use foreach on non-array: '' at jmxbean.sl:21
Warning: No such operation gc at jmxbean.sl:49
Warning: Attempted to call a non-static method on a null reference at
jcdinfo.sl:17
Warning: Attempted to call a non-static method on a null reference at
jcdinfo.sl:17
Warning: Attempted to call a non-static method on a null reference at
jcdinfo.sl:18
Warning: Attempted to call a non-static method on a null reference at
jcdinfo.sl:29


jcdinfo.sl is running with debug(debug() | 34);

What's printed seems to suggest a problem with including files; not a
problem with jmx_connect.

Raphael Mudge

unread,
Oct 2, 2008, 6:06:47 PM10/2/08
to sleep-de...@googlegroups.com
I'd say it looks like a problem including files (possibly a syntax
error in the file you're including). Make sure you set debug flags
in the most top-level script. include doesn't dump directly to the
console when an error occurs. It flags an error. You'll recall with
debug 34 enabled any error will automatically throw an exception.

For the sake of keeping sanity, I recommend every sleep scripter hack
with debug(7) enabled. So you'd do debug(debug() | 7 | 34). Flag 1
shows any hard errors. This is usually errors in the interpreter
(usually caused by misbehaved scripts). Flag 1 is on by default.
Flag 2 shows all flagged errors as they happen. This is stuff you
can capture programatically with try/catch or checkError(). Errors
from include will show this way. Flag 4 is strict mode which forces
Sleep to complain if you use a variable with declaring it. 1 | 2 | 4
= 7.

Other options include debug(debug() | 15) to turn on tracing so you
can see what is happening. You'll see include("../whatever.sl")
FAILED! if there was a problem.

Hope that helps.

-- Raphael

Reply all
Reply to author
Forward
0 new messages