You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2006/06/28 20:36:29 UTC

[jira] Created: (STDCXX-229) better exception error messages

better exception error messages
-------------------------------

         Key: STDCXX-229
         URL: http://issues.apache.org/jira/browse/STDCXX-229
     Project: C++ Standard Library
        Type: Improvement

  Components: 18. Language Support, 19. Diagnostics  
    Versions: 4.1.2, 4.1.3    
 Environment: all
    Reporter: Martin Sebor


****Created By: sebor @ Apr 24, 2001 12:11:59 PM****
Subject: better exception error messages (by using CRTL's strerror()?) (1601)
Date: Tue, 24 Apr 2001 10:57:13 -0400
From: cxxrtl@cxxc.zko.dec.com
To: OEMSUPPORT@roguewave.com

A customer requested that the what() string for a standard iostream
error be more descriptive, possibly by using the strerror() or
perror() function to return the underlying CRTL error string...

Example:

#define __USE_STD_IOSTREAM
#include <fstream>
#include <string>

int main() {
    try {
        std::ofstream out;
        out.exceptions(std::ios_base::badbit);
        out.open("#3.2_BLUE_%.LinkedText");
        out << "Hello!" << std::endl;
    }
    catch (std::exception& e) {
        perror("The funny looking name that isn't in scope anymore");
        std::cerr << e.what();
    }
}
------------------------------- test.cxx -------------------------------

$ run test
The funny looking name that isn't in scope anymore: non-translatable vms 
error code: 0x186D4 %rms-f-syn, file specification syntax error
iostream object has failbit set

****Modified By: sebor @ Sep 29, 2003 11:44:10 AM****
This would be quite useful but it's non trivial to do in iostreams where exceptions are thrown from stream classes but errors of interest typically occur in stream buffers. Once possibility is to selectively capture and save errno in a thread-safe way (so that it can be later modified w/o affecting the recorded cause of the original error) when it occurs during libc and system calls made from streambuf members and later retrieve it when an exception is about to be thrown from the stream class.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (STDCXX-229) better exception error messages

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor updated STDCXX-229:
--------------------------------

             Severity: Cosmetic
    Affects Version/s: 4.2.0

Added 4.2.0 to the list of Affected Versions and set Severity to Cosmetic.

> better exception error messages
> -------------------------------
>
>                 Key: STDCXX-229
>                 URL: https://issues.apache.org/jira/browse/STDCXX-229
>             Project: C++ Standard Library
>          Issue Type: Improvement
>          Components: 18. Language Support, 19. Diagnostics
>    Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0
>         Environment: all
>            Reporter: Martin Sebor
>             Fix For: 4.3
>
>
> ****Created By: sebor @ Apr 24, 2001 12:11:59 PM****
> Subject: better exception error messages (by using CRTL's strerror()?) (1601)
> Date: Tue, 24 Apr 2001 10:57:13 -0400
> From: cxxrtl@cxxc.zko.dec.com
> To: OEMSUPPORT@roguewave.com
> A customer requested that the what() string for a standard iostream
> error be more descriptive, possibly by using the strerror() or
> perror() function to return the underlying CRTL error string...
> Example:
> #define __USE_STD_IOSTREAM
> #include <fstream>
> #include <string>
> int main() {
>     try {
>         std::ofstream out;
>         out.exceptions(std::ios_base::badbit);
>         out.open("#3.2_BLUE_%.LinkedText");
>         out << "Hello!" << std::endl;
>     }
>     catch (std::exception& e) {
>         perror("The funny looking name that isn't in scope anymore");
>         std::cerr << e.what();
>     }
> }
> ------------------------------- test.cxx -------------------------------
> $ run test
> The funny looking name that isn't in scope anymore: non-translatable vms 
> error code: 0x186D4 %rms-f-syn, file specification syntax error
> iostream object has failbit set
> ****Modified By: sebor @ Sep 29, 2003 11:44:10 AM****
> This would be quite useful but it's non trivial to do in iostreams where exceptions are thrown from stream classes but errors of interest typically occur in stream buffers. Once possibility is to selectively capture and save errno in a thread-safe way (so that it can be later modified w/o affecting the recorded cause of the original error) when it occurs during libc and system calls made from streambuf members and later retrieve it when an exception is about to be thrown from the stream class.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (STDCXX-229) better exception error messages

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor updated STDCXX-229:
--------------------------------

    Affects Version/s: 4.1.4
        Fix Version/s: 4.3

Added 4.1.4 to affected versions. Deferred for 4.3 (or possibly later). We might want to consider N2303 when designing this:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2303.html

> better exception error messages
> -------------------------------
>
>                 Key: STDCXX-229
>                 URL: https://issues.apache.org/jira/browse/STDCXX-229
>             Project: C++ Standard Library
>          Issue Type: Improvement
>          Components: 18. Language Support, 19. Diagnostics
>    Affects Versions: 4.1.2, 4.1.3, 4.1.4
>         Environment: all
>            Reporter: Martin Sebor
>             Fix For: 4.3
>
>
> ****Created By: sebor @ Apr 24, 2001 12:11:59 PM****
> Subject: better exception error messages (by using CRTL's strerror()?) (1601)
> Date: Tue, 24 Apr 2001 10:57:13 -0400
> From: cxxrtl@cxxc.zko.dec.com
> To: OEMSUPPORT@roguewave.com
> A customer requested that the what() string for a standard iostream
> error be more descriptive, possibly by using the strerror() or
> perror() function to return the underlying CRTL error string...
> Example:
> #define __USE_STD_IOSTREAM
> #include <fstream>
> #include <string>
> int main() {
>     try {
>         std::ofstream out;
>         out.exceptions(std::ios_base::badbit);
>         out.open("#3.2_BLUE_%.LinkedText");
>         out << "Hello!" << std::endl;
>     }
>     catch (std::exception& e) {
>         perror("The funny looking name that isn't in scope anymore");
>         std::cerr << e.what();
>     }
> }
> ------------------------------- test.cxx -------------------------------
> $ run test
> The funny looking name that isn't in scope anymore: non-translatable vms 
> error code: 0x186D4 %rms-f-syn, file specification syntax error
> iostream object has failbit set
> ****Modified By: sebor @ Sep 29, 2003 11:44:10 AM****
> This would be quite useful but it's non trivial to do in iostreams where exceptions are thrown from stream classes but errors of interest typically occur in stream buffers. Once possibility is to selectively capture and save errno in a thread-safe way (so that it can be later modified w/o affecting the recorded cause of the original error) when it occurs during libc and system calls made from streambuf members and later retrieve it when an exception is about to be thrown from the stream class.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-229) better exception error messages

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547692 ] 

Martin Sebor commented on STDCXX-229:
-------------------------------------

A common request is to add the stack trace at the call site to the exception what() string. See, for example, the following gcc enhancement request: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33903

> better exception error messages
> -------------------------------
>
>                 Key: STDCXX-229
>                 URL: https://issues.apache.org/jira/browse/STDCXX-229
>             Project: C++ Standard Library
>          Issue Type: Improvement
>          Components: 18. Language Support, 19. Diagnostics
>    Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0
>         Environment: all
>            Reporter: Martin Sebor
>             Fix For: 4.3
>
>
> ****Created By: sebor @ Apr 24, 2001 12:11:59 PM****
> Subject: better exception error messages (by using CRTL's strerror()?) (1601)
> Date: Tue, 24 Apr 2001 10:57:13 -0400
> From: cxxrtl@cxxc.zko.dec.com
> To: OEMSUPPORT@roguewave.com
> A customer requested that the what() string for a standard iostream
> error be more descriptive, possibly by using the strerror() or
> perror() function to return the underlying CRTL error string...
> Example:
> #define __USE_STD_IOSTREAM
> #include <fstream>
> #include <string>
> int main() {
>     try {
>         std::ofstream out;
>         out.exceptions(std::ios_base::badbit);
>         out.open("#3.2_BLUE_%.LinkedText");
>         out << "Hello!" << std::endl;
>     }
>     catch (std::exception& e) {
>         perror("The funny looking name that isn't in scope anymore");
>         std::cerr << e.what();
>     }
> }
> ------------------------------- test.cxx -------------------------------
> $ run test
> The funny looking name that isn't in scope anymore: non-translatable vms 
> error code: 0x186D4 %rms-f-syn, file specification syntax error
> iostream object has failbit set
> ****Modified By: sebor @ Sep 29, 2003 11:44:10 AM****
> This would be quite useful but it's non trivial to do in iostreams where exceptions are thrown from stream classes but errors of interest typically occur in stream buffers. Once possibility is to selectively capture and save errno in a thread-safe way (so that it can be later modified w/o affecting the recorded cause of the original error) when it occurs during libc and system calls made from streambuf members and later retrieve it when an exception is about to be thrown from the stream class.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.