Hi,
I wish it was possible to write our own warnings and errors to the console
from the scad script.
Typical usage could be:
module test(value) {
if (value < 10)
warning("Value less than 10 is a bad idea.");
if (value < 0)
error("Value less than zero are not valid");
}
The error() could perhaps include a stop=true parameter, which would halt
the script execution.
What do you think? Are there exiting methods in place already that I've
missed?
--
View this message in context: http://forum.openscad.org/Wish-error-and-warning-tp10840.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
echo(); ?
--
View this message in context: http://forum.openscad.org/Wish-error-and-warning-tp10840p10877.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
warning() and error() would be better than echo() as they could use the built
in coloring.
And error() could be used somewhat like a breakpoint, so that you get the
red error-dot in the editor.
My workaround so far is this;
module warning(message) {
echo(str("WARNING: " , message, ""));
}
--
View this message in context: http://forum.openscad.org/Wish-error-and-warning-tp10840p10880.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
module warn(msg) {
m = str("<html>", msg, "</html>");
echo(m);
}
warn("The end of the world is nigh");
module error(msg) {
m = str("<html>", msg, "</html>");
echo(m);
// I can't think of a way to terminate evaluation
}
error("This is the end");
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Wish-error-and-warning-tp10840p10886.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Woops that didn't work, file attached warn-error.scad
http://forum.openscad.org/file/n10887/warn-error.scad
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Wish-error-and-warning-tp10840p10887.html
Sent from the OpenSCAD mailing list archive at Nabble.com.