Prefixed warnings and errors

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Prefixed warnings and errors

nophead
I noticed the error and warning messages have grown a prefix, breaking my scripts. Easy to fix but I wonder what the purpose is?. Would it be better to strip the prefix before printing them?


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Prefixed warnings and errors

MichaelPFrey
On 11.01.19 11:08, nop head wrote:
> I noticed the error and warning messages have grown a prefix, breaking
> my scripts. Easy to fix but I wonder what the purpose is?. Would it be
> better to strip the prefix before printing them?

The prefixes are from the ability to stop on the first warning.

I throw an exception at the first (literal) "WARNING".

Now some warnings caused issues, as I did not find the right place to
catch the exception.

With https://github.com/openscad/openscad/pull/2667 I found one of the
slipping exceptions, now that this is merged, I can look into it what
prefixes I can now remove.

Note that I would like to keep the UI-WARNING prefixes (or something
alike) as those are really messy and clearly different from warnings
caused by user code.


With kind regards,

Michael


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Prefixed warnings and errors

nophead
I am not sure how you can say the  UI-WARNING  are not caused by the user code. I can write:

$vpr=0;

and get

UI-WARNING: Unable to convert $vpr= 0 to a vec3 or vec2 of numbers


I can subtract a cylinder from a cube of the same size to create a knife edge and get


UI-WARNING: Object may not be a valid 2-manifold and may need repair!


The distinguishing feature seems to be that they only happen in GUI mode, you can't get them on the command line. But that isn't really significant to me as a user, it just looks messy. Can't you just strip them as they are printed to avoid the console looking messy but keep them in the code if you need the information they convey to process them?





On Fri, 11 Jan 2019 at 17:03, Michael Frey <[hidden email]> wrote:
On 11.01.19 11:08, nop head wrote:
> I noticed the error and warning messages have grown a prefix, breaking
> my scripts. Easy to fix but I wonder what the purpose is?. Would it be
> better to strip the prefix before printing them?

The prefixes are from the ability to stop on the first warning.

I throw an exception at the first (literal) "WARNING".

Now some warnings caused issues, as I did not find the right place to
catch the exception.

With https://github.com/openscad/openscad/pull/2667 I found one of the
slipping exceptions, now that this is merged, I can look into it what
prefixes I can now remove.

Note that I would like to keep the UI-WARNING prefixes (or something
alike) as those are really messy and clearly different from warnings
caused by user code.


With kind regards,

Michael


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|

Re: Prefixed warnings and errors

tp3
What is the script doing with the Warning/Error lines?

ciao,
   Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: Prefixed warnings and errors

nophead
It runs OpenSCAD, captures stdout and stderr and prints any lines beginning with ERROR: or WARNING:. I.e. avoiding things like "Compiling design" and "Normalized CSG tree" messages, which are not very useful.

On Fri, 11 Jan 2019 at 17:33, Torsten Paul <[hidden email]> wrote:
What is the script doing with the Warning/Error lines?

ciao,
   Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|

Re: Prefixed warnings and errors

tp3
On 11.01.19 19:10, nop head wrote:
> It runs OpenSCAD, captures stdout and stderr and prints any lines
> beginning with ERROR: or WARNING:. I.e. avoiding things like "Compiling
> design" and "Normalized CSG tree" messages, which are not very useful.

Hmm, so changing it to maybe ERROR:UI: could be a compromise for the
time being? I guess if we ever find the time it would make sense to
handle the information a bit more specific internally instead of relying
on the strings, but that's a quite invasive change even if not a very
complicated one.

ciao,
   Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: Prefixed warnings and errors

nophead
Well I can easily change my script to look for ERROR: anywhere instead of the beginning. It isn't published yet so changing is no problem at all. But I don't like the console looking more complicated for no extra information.

On Fri, 11 Jan 2019 at 18:26, Torsten Paul <[hidden email]> wrote:
On 11.01.19 19:10, nop head wrote:
> It runs OpenSCAD, captures stdout and stderr and prints any lines
> beginning with ERROR: or WARNING:. I.e. avoiding things like "Compiling
> design" and "Normalized CSG tree" messages, which are not very useful.

Hmm, so changing it to maybe ERROR:UI: could be a compromise for the
time being? I guess if we ever find the time it would make sense to
handle the information a bit more specific internally instead of relying
on the strings, but that's a quite invasive change even if not a very
complicated one.

ciao,
   Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Prefixed warnings and errors

nophead
BTW, if I enable stop on first warning it seems to prevent another F5 or F6 once I get a warning. I have to turn it off to be able to continue.

OpenSCAD 2019.01.03.ci933


On Fri, 11 Jan 2019 at 18:36, nop head <[hidden email]> wrote:
Well I can easily change my script to look for ERROR: anywhere instead of the beginning. It isn't published yet so changing is no problem at all. But I don't like the console looking more complicated for no extra information.

On Fri, 11 Jan 2019 at 18:26, Torsten Paul <[hidden email]> wrote:
On 11.01.19 19:10, nop head wrote:
> It runs OpenSCAD, captures stdout and stderr and prints any lines
> beginning with ERROR: or WARNING:. I.e. avoiding things like "Compiling
> design" and "Normalized CSG tree" messages, which are not very useful.

Hmm, so changing it to maybe ERROR:UI: could be a compromise for the
time being? I guess if we ever find the time it would make sense to
handle the information a bit more specific internally instead of relying
on the strings, but that's a quite invasive change even if not a very
complicated one.

ciao,
   Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org