[M3devel] Style question about error messages

Coleburn, Randy rcolebur at SCIRES.COM
Tue Feb 23 22:05:57 CET 2010


Hendrik:

I have run into this situation also.  If you have code that runs on multiple platforms, you have to think through the best way to handle.  For example, code might work differently say between Unix and Windows.  Indeed, if you have a Windows GUI mode program and try to write to stdout there is some magic that is used to allocate a console writer on the fly.  Also, if you know you aren't using Alerts, you might be ok using the FATAL pragma as Tony suggests, but then for Wr.Failure you may want to take a different course.  Also, depending on your program, you may want to trap both of these so you can clean up any other resource use before terminating the program.  If you want more specifics, I can dig into some of my code for examples.

Regards,
Randy

-----Original Message-----
From: Tony Hosking [mailto:hosking at cs.purdue.edu]
Sent: Tuesday, February 23, 2010 2:16 PM
To: hendrik at topoi.pooq.com
Cc: m3devel at elegosoft.com
Subject: Re: [M3devel] Style question about error messages

You can just record that exception as fatal in that code block with the <*FATAL Thread.Alerted*> pragma.

On 23 Feb 2010, at 13:19, hendrik at topoi.pooq.com wrote:

> Somewhere in my program after it has trued and failed to read the
> input file, I have the code
>
> Wr.PutText(Stdio.stderr, "No input file.\n");
>
> Now presumably this message could be more detailed, but that's not waht
> I'm asking.  What happens to me when I compile this code is the warning:
>
> "../src/Main.m3", line 63: warning: potentially unhandled exceptions:
> Thread.Alerted, Wr.Failure
>
> Now presumably this is an indication that I ought to wrap the whole
> thing in a TRY clause.  But what am I supposed to do if the attempt to
> produce an error message fails?  Write an error message?
>
> What have other people done in this situation?
>
> --hendrik


CONFIDENTIALITY NOTICE:  This email and any attachments are intended solely for the use of the named recipient(s).  This email may contain confidential and/or proprietary information of Scientific Research Corporation.  If you are not a named recipient, you are prohibited from reviewing, copying, using, disclosing or distributing to others the information in this email and attachments.  If you believe you have received this email in error, please notify the sender immediately and permanently delete the email, any attachments, and all copies thereof from any drives or storage media and destroy any printouts of the email or attachments.

EXPORT COMPLIANCE NOTICE:  This email and any attachments may contain technical data subject to U.S export restrictions under the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR).  Export or transfer of this technical data and/or related information to any foreign person(s) or entity(ies), either within the U.S. or outside of the U.S., may require advance export authorization by the appropriate U.S. Government agency prior to export or transfer.  In addition, technical data may not be exported or transferred to certain countries or specified designated nationals identified by U.S. embargo controls without prior export authorization.  By accepting this email and any attachments, all recipients confirm that they understand and will comply with all applicable ITAR, EAR and embargo compliance requirements.



More information about the M3devel mailing list