Visual C++

Hi

I have a static method in a class that parses a text string.  It basically
breaks the text string down into segments and then calls further static
methods to do what it has to with those segments.  If any part of the
parsing fails in those sub-methods, they throw a user exception using
AfxThrowUserException().

Then, the main static Parsing method catches the user exception, and assigns
the return value to be FALSE.  Hence the main calling code displays an error
message to the user saying that parsing failed.

That works fine.  The question is, how do I go about having an exception
thrown that is exactly the same, but lets me give it some kind of error
value. Eg:

If(!parsestring(string, structure, myownexception))
{
        display error message myownexception.geterrorno
}

I don't even know if I need to go this far. Can I simply use SetLastError
and GetLastError using my own values?  I have used GetLastError before, but
only on system methods that use it.

All I am trying to achieve is a easy way of knowing why the parsing
failed...  Specificalled:

Unable to parse date
Unable to parse time
Unable to parse number of months
Invalid number of segments
Andrew Truckle 
CAD Manager 
Atkins 
Survey and Mapping 
Connect 17 
Avon Way, 
Langley Park, 
Chippenham 
Wilts SN15 1GG 

Direct Phone: 01249 455032 
Switchboard: 01249 455000 
Fax: 01249 455045 
email:[EMAIL PROTECTED]




This email and any attached files are confidential and copyright protected.
If you are not the addressee, any dissemination of this communication is
strictly prohibited. Unless otherwise expressly agreed in writing, nothing
stated in this communication shall be legally binding.



_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription 
changes, and list archive.

Reply via email to