Commit 9f1f7aa9 authored by Nigel Kukard's avatar Nigel Kukard

Merge branch 'nkloadfile' into 'master'

Better error handling

See merge request !15
parents ff1dfebe 8c4acd9d
Pipeline #457 passed with stages
in 59 seconds
......@@ -165,7 +165,7 @@ sub ui_start
# For everything else try open the file
} else {
# Exit with code given by the loadFile function
if (loadFile(\*STDERR,"file='$file'") < 0) {
if (loadFile($OUT,"file='$file'") < 0) {
exit 1;
}
}
......@@ -240,7 +240,7 @@ sub loadFile
# Process
if ((my $res = processCommand($OUT,$cmdline)) < 0) {
print($OUT " => Failed to execute command: $cmdline\n");
print($OUT " => Failed to execute command on line $line_current: $cmdline\n");
return $res;
}
}
......@@ -490,13 +490,13 @@ sub processCommand
} elsif ($res > 0) {
# print($OUT " => Ok! (res: $res)\n");
} elsif ($res == -103) {
print($OUT " => ERROR - Not authorized to access this function\n");
print($OUT " => ERROR - Not authorized to access this function: $cmdline\n");
} elsif ($res == -200) {
print($OUT " => ERROR - Invalid command\n");
print($OUT " => ERROR - Invalid command: $cmdline\n");
} elsif ($res == -201) {
print($OUT " => ERROR - Command not valid in this state\n");
print($OUT " => ERROR - Command not valid in this state: $cmdline\n");
} elsif ($res == -202) {
print($OUT "Usage Error...\n");
print($OUT " => ERROR - Usage error: $cmdline\n");
print($OUT " ".$matchedCmd->{'Help'}."\n");
} else {
print($OUT " => ERROR - Processing line: $cmdline\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment