When I run an Erlang function using IntelliJ's "Run Configuration", I am getting the following error message. The error message contains lot of nested brackets. Please help me in understanding the message.
"C:\Program Files\Erlang OTP\bin\erl.exe" -pa F:/1TB/P/workspace-IntelliJ-Erlang2/netconfClient/out/production/netconfClient -pa F:/1TB/P/workspace-IntelliJ-Erlang2/netconfClient -eval netconfManager:open2(). -s init stop -noshell
init terminating in do_boot ({badarg,[{ets,select,[ct_attributes,[_]],[{_}]},{ct_config,get_key_from_name,1,[{_},{_}]},{ct_util,does_connection_exist,3,[{_},{_}]},{ct_gen_conn,do_start,4,[{_},{_}]},{ct_netconfc,open,4,[{_},{_}]},{erl_eval,do_apply,7,[{_},{_}]},{init,start_it,1,[{_},{_}]},{init,start_em,1,[{_},{_}]}]})
Crash dump is being written to: erl_crash.dump...{"init terminating in do_boot",{badarg,[{ets,select,[ct_attributes,[{{ct_conf,'$1','_','_','_',undefined,'_'},[],['$1']}]],[{error_info,#{cause=>id,module=>erl_stdlib_errors}}]},{ct_config,get_key_from_name,1,[{file,"ct_config.erl"},{line,578}]},{ct_util,does_connection_exist,3,[{file,"ct_util.erl"},{line,577}]},{ct_gen_conn,do_start,4,[{file,"ct_gen_conn.erl"},{line,281}]},{ct_netconfc,open,4,[{file,"ct_netconfc.erl"},{line,424}]},{erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,744}]},{init,start_it,1,[{file,"init.erl"},{line,1234}]},{init,start_em,1,[{file,"init.erl"},{line,1220}]}]}}
done
Right click on a function in a .erl file and click on "Run ."
The error message consists of Error code and Stack trace.
Error code is badarg. Please refer to
Exit Reasons for the list of error code.
The stack trace contains one entry for each function call. Each call
provides file name, function name, line number. For example,
{init,start_em,1,[{file,"init.erl"},{line,1220}]} indicates that
init.erl is the file, start_em is the function and 1220 is line #.
After manual indentation, we could better visualize the stacktrace as follows.
{badarg,[
{ets,select,[ct_attributes,[_]],[{_}]},
{ct_config,get_key_from_name,1,[{_},{_}]},
{ct_util,does_connection_exist,3,[{_},{_}]},
{ct_gen_conn,do_start,4,[{_},{_}]},
{ct_netconfc,open,4,[{_},{_}]},
{erl_eval,do_apply,7,[{_},{_}]},
{init,start_it,1,[{_},{_}]},
{init,start_em,1,[{_},{_}]}
]}
{badarg,[
{ets,select,[ct_attributes,[{{ct_conf,'$1','_','_','_',undefined,'_'},[],['$1']}]],[{error_info,#{cause=>id,module=>erl_stdlib_errors}}]},
{ct_config,get_key_from_name,1,[{file,"ct_config.erl"},{line,578}]},
{ct_util,does_connection_exist,3,[{file,"ct_util.erl"},{line,577}]},
{ct_gen_conn,do_start,4,[{file,"ct_gen_conn.erl"},{line,281}]},
{ct_netconfc,open,4,[{file,"ct_netconfc.erl"},{line,424}]},
{erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,744}]},
{init,start_it,1,[{file,"init.erl"},{line,1234}]},
{init,start_em,1,[{file,"init.erl"},{line,1220}]}
]}
I have the next system swi-prolog in a file call 'system.pl';
helloWorld :- read(X), write(X).
And i want to test it, then, i write it;
:- begin_tests(helloWorld_test).
test(myTest, true(Output == "hello")) :-
with_output_to(string(Output), getEntry).
:- end_tests(helloWorld_test).
getEntry :-
open('testcase.test', read, Myfile),
set_input(Myfile),
process_create(path(swipl), ['-g', 'main', '-t', 'halt', 'system.pl'], [stdin(stream(Myfile)), stdout(pipe(Stream))]),
copy_stream_data(Stream, current_output),
close(Myfile).
In testcase.test is contained the following;
hello.
Ok, now, when i call to swipl -g run_tests -t halt system.pl i get it;
% PL-Unit: helloWorld_test ERROR: -g helloWorld: read/1: I/O error in read on stream user_input (Bad file descriptor)
ERROR: c:/programasvscode/prolog/programasrandom/system.pl:40:
test myTest: wrong answer (compared using ==)
ERROR: Expected: "hello"
ERROR: Got: ""
done
% 1 test failed
% 0 tests passed
ERROR: -g run_tests: false
Warning: Process "c:\swipl\bin\swipl.exe": exit status: 2
I tried use read/2 with current_input but i got the same with the difference of read/2 instead read/1
What does mean it? any solve?
I have a test script I'm running that generates some errors,shown below, I expect these errors. Is there anyway I can prevent them from showing on the screen however? I use the
$ write sys$output
to display if there is an expected error.
I tried to use
$ DEFINE SYS$ERROR ERROR.LOG
but this then changed my entire error output log to this, if this is the correct way to handle it can I unset this at the end of my script somehow?
[error example]
%DCL-E-OPENIN, error opening TEST$DISK:[AAA]NOTTHERE.TXT; as input
-RMS-E-FNF, file not found
%DCL-E-OPENIN, error opening TEST$DISK:[AAA]NOTTHERE.TXT; as input
-RMS-E-FNF, file not found
%DCL-W-UNDFIL, file has not been opened by DCL - check logical name
DEFINE/USER creates a logical name that disappears when the next image exits.
So if you use that just before a command just to protect that command, then fine.
Otherwise I would prefer SET MESSAGE to control the output.
And of course yoy want to grab $STATUS and verify it after the command for success or for the expected error, reporting any unexpected error.
Better still... if you expect certain error conditions to occur,
then why not test for them?
For example:
$ file = F$SEARCH("TEST$DISK:[AAA]NOTTHERE.TXT")
$ IF file.NES."" THEN TYPE 'file'
Cheers,
Hein
To suppress Error message inside a script. try this command
$ DEFINE/USER SYS$ERROR NL:
NL: is a null device, so you don`t see any error messages displayed on your terminal.
good luck
This works interactively and in batch.
$ SET MESSAGE /NOTEXT /NOSEV /NOFAC /NOID
$ <DCL_Command>
$ SET MESSAGE /TEXT /SEV /FAC/ ID