Displaying 6 results from an estimated 6 matches for "mycustomerror".
2016 Feb 03
13
[RFC] Error handling in LLVM libraries.
...omeone else) it will call std::terminate(). TypedError cannot be silently
dropped.
2. A utility class, TypedErrorInfo, for building error class hierarchies
rooted at 'TypedErrorInfoBase' with custom RTTI. E.g.
// Define a new error type implicitly inheriting from TypedErrorInfoBase.
class MyCustomError : public TypedErrorInfo<MyCustomError> {
public:
// Custom error info.
};
// Define a subclass of MyCustomError.
class MyCustomSubError : public TypedErrorInfo<MyCustomSubError,
MyCustomError> {
public:
// Extends MyCustomError, adds new members.
};
3. A set of utility functions...
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
...ics of this kind, but it showcases the value of being able to
modify errors while they're in-flight.
> Is your call to catchAllTypedErrors(…) actually like a switch on the type
of the error? What about a syntax that looks like a switch?
>
> switchErr(std::move(Err))
> .case< MyCustomError>([] () { /* … */ })
> .case< MyOtherCustomError>([] () { /* … */ })
> .default([] () { /* … */ })
It's similar to a switch, but it's actually more like a list of regular C++
exception catch blocks (the name 'catchTypedError' is a nod to this).
The big differenc...
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
...the handler and how is it handled?
>>
>>
>>
>> > Is your call to catchAllTypedErrors(…) actually like a switch on the
>> type of the error? What about a syntax that looks like a switch?
>> >
>> > switchErr(std::move(Err))
>> > .case< MyCustomError>([] () { /* … */ })
>> > .case< MyOtherCustomError>([] () { /* … */ })
>> > .default([] () { /* … */ })
>>
>> It's similar to a switch, but it's actually more like a list of regular
>> C++ exception catch blocks (the name 'catchTypedErr...
2016 Feb 03
6
[RFC] Error handling in LLVM libraries.
..., now what is a failure of
> the handler and how is it handled?
>
>
>
> > Is your call to catchAllTypedErrors(…) actually like a switch on the
> type of the error? What about a syntax that looks like a switch?
> >
> > switchErr(std::move(Err))
> > .case< MyCustomError>([] () { /* … */ })
> > .case< MyOtherCustomError>([] () { /* … */ })
> > .default([] () { /* … */ })
>
> It's similar to a switch, but it's actually more like a list of regular
> C++ exception catch blocks (the name 'catchTypedError' is a nod to...
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
...ypedError cannot be silently dropped.
>>
>> 2. A utility class, TypedErrorInfo, for building error class hierarchies rooted at 'TypedErrorInfoBase' with custom RTTI. E.g.
>>
>> // Define a new error type implicitly inheriting from TypedErrorInfoBase.
>> class MyCustomError : public TypedErrorInfo<MyCustomError> {
>> public:
>> // Custom error info.
>> };
>>
>> // Define a subclass of MyCustomError.
>> class MyCustomSubError : public TypedErrorInfo<MyCustomSubError, MyCustomError> {
>> public:
>> // Exte...
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
...d?
>>>
>>>
>>>
>>> > Is your call to catchAllTypedErrors(…) actually like a switch on the
>>> type of the error? What about a syntax that looks like a switch?
>>> >
>>> > switchErr(std::move(Err))
>>> > .case< MyCustomError>([] () { /* … */ })
>>> > .case< MyOtherCustomError>([] () { /* … */ })
>>> > .default([] () { /* … */ })
>>>
>>> It's similar to a switch, but it's actually more like a list of regular
>>> C++ exception catch blocks (the nam...