Displaying 6 results from an estimated 6 matches for "catchalltypederror".
Did you mean:
catchalltypederrors
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
...ill be run, giving us an opportunity to tag
the error as having occurred within archive A.
Again - this is a straw-man example: I think we can do better again for
diagnostics 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 sim...
2016 Feb 03
13
[RFC] Error handling in LLVM libraries.
.../ Define a subclass of MyCustomError.
class MyCustomSubError : public TypedErrorInfo<MyCustomSubError,
MyCustomError> {
public:
// Extends MyCustomError, adds new members.
};
3. A set of utility functions that use the custom RTTI system to inspect
and handle typed errors. For example 'catchAllTypedErrors' and
'handleTypedError' cooperate to handle error instances in a type-safe way:
TypedError foo() {
if (SomeFailureCondition)
return make_typed_error<MyCustomError>();
}
TypedError Err = foo();
catchAllTypedErrors(std::move(Err),
handleTypedError<MyCustomError>(...
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
...d, but it showcases the value of being able to
>> modify errors while they're in-flight.
>>
>>
>> Sure, this case shows “success” of the handler, 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>([] () { /* … */ })
>...
2016 Feb 03
6
[RFC] Error handling in LLVM libraries.
...ain for
> diagnostics of this kind, but it showcases the value of being able to
> modify errors while they're in-flight.
>
>
> Sure, this case shows “success” of the handler, 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([]...
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
...ng able to
>>> modify errors while they're in-flight.
>>>
>>>
>>> Sure, this case shows “success” of the handler, 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>([]...
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
...yCustomSubError : public TypedErrorInfo<MyCustomSubError, MyCustomError> {
>> public:
>> // Extends MyCustomError, adds new members.
>> };
>>
>> 3. A set of utility functions that use the custom RTTI system to inspect and handle typed errors. For example 'catchAllTypedErrors' and 'handleTypedError' cooperate to handle error instances in a type-safe way:
>>
>> TypedError foo() {
>> if (SomeFailureCondition)
>> return make_typed_error<MyCustomError>();
>> }
>>
>> TypedError Err = foo();
>>
>&g...