|
Boost : |
From: Kevlin Henney (kevlin_at_[hidden])
Date: 2001-10-17 01:04:08
> From: Thomas Matelich <toms-mailing-lists_at_[hidden]>
>Perhaps it would be helpful to provide an explanation as to which part of the
>cast caused the exception:
>
>if(!(interpreter << arg))
> throw bad_lexical_cast("Source Insertion");
>if(!(interpreter >> result))
> throw bad_lexical_cast("Result Extraction");
>if(!(interpreter >> STD ws).eof())
> throw bad_lexical_cast("Not At End Of Available Data");
>
>an enum might be smarter. Also would it be too much overhead to have the
>type_info's of the types used available in the
>exception? I tend to use one blanket catch for a lot of lexical_casts, and it
>gets to be a pain to track down which one threw.
I think this is an excellent suggestion. What are Booster preferences
from the following possibilities:
(1) Add specific throws:
(a) Not at all.
(b) Distinguished by initialiser string.
(c) Distinguished by enum.
(d) Both (b) and (c).
(2) Add type information details:
(a) Not at all.
(b) In exception result string.
(c) As attributes to represent the type_info of the source and target.
(d) Both (b) and (c).
Kevlin
____________________________________________________________
Kevlin Henney phone: +44 117 942 2990
mailto:kevlin_at_[hidden] mobile: +44 7801 073 508
http://www.curbralan.com fax: +44 870 052 2289
Curbralan: Consultancy + Training + Development + Review
____________________________________________________________
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk