Re: conversion: errno => exception

From: Alf P. Steinbach (alfps_at_start.no)
Date: 11/08/04


Date: Mon, 08 Nov 2004 18:08:01 GMT


* Rolf Magnus:
> Alf P. Steinbach wrote:
>
> > * Markus Elfring:
> >> Do you know a class library that can convert the error/return codes
> >> that are listed in the standard header file "errno.h" into a
> >> well-known exception hierarchy?
> >> Did anybody derive it from "std:runtime_error"?
> >
> > Why do you want a hierarchy?
> >
> > Off the cuff:
> >
> > void throwStdIoError()
> > {
> > throw std::runtime_error( std::strerror( std::errno ) );
> > }
>
> It would be quite hard for the function that catches the exception to find
> out what the error actually is.

If it's not within the context of the throwing call, why should it care?

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


Relevant Pages