search for: catchtypederrors

Displaying 6 results from an estimated 6 matches for "catchtypederrors".

2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
...#39;t turn up anything interesting. If anybody has seen other error handling schemes of note I'd love to hear about them. > On this topic of not paying the price on the non-error code path, it would be nice to not pay for constructing all the lambda captures when there is no error. If your catchTypedErrors call is under an if-test then the lambdas are in a scope that won't be entered on the non-error path: if (auto Err = foo()) if (auto E2 = catchTypedErrors(std::move(Errs), <lambdas here>)) return; I think (though I haven't tested this) that most lambdas should inline away to n...
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
...the handler, now what is a failure > of the handler and how is it handled? > > Sorry - that was a bad example to choose: That was actually showcasing > failure, not success. Success looks like this: > > TypedError bar() { > TypedError Err = foo; > if (auto E2 = > catchTypedErrors(std::move(Err), > handleTypedError<MyError>([&](std::unique_ptr<MyError> M) { > // Deal with 'M' somehow. > return TypedError(); > })) > return E2; > > // Proceed with 'bar' if 'Err' is handled. > } &g...
2016 Feb 03
6
[RFC] Error handling in LLVM libraries.
...T. > Sure, this case shows “success” of the handler, now what is a failure of the handler and how is it handled? Sorry - that was a bad example to choose: That was actually showcasing failure, not success. Success looks like this: TypedError bar() { TypedError Err = foo; if (auto E2 = catchTypedErrors(std::move(Err), handleTypedError<MyError>([&](std::unique_ptr<MyError> M) { // Deal with 'M' somehow. return TypedError(); })) return E2; // Proceed with 'bar' if 'Err' is handled. } A key observation is that catchTypedErro...
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
..."', "; OS << "In object file '" << ObjectName << "', " << EC.message(); } }; TypedError processArchive(Archive &A) { TypedError Err; for (auto &Obj : A) { auto Err = processObject(Obj); if (auto E2 = catchTypedErrors(std::move(Err), handleTypedError<ObjectError>([&](std::unique_ptr<ObjectError> OE) { OE->ArchiveName = A.getName(); return TypedError(std::move(OE)); })) return E2; } } In this example, any error (whether an ObjectError or something els...
2016 Feb 03
2
[RFC] Error handling in LLVM libraries.
Hi James, > It seems to me that "[[clang::warn_unused_result]] class TypedError" is probably sufficient for ensuring people check a status return value; I'm not sure runtime checking really brings much additional value there. I see the attribute as complimentary. The runtime check provides a stronger guarantee: the error cannot be dropped on any path, rather than just "the
2016 Feb 03
13
[RFC] Error handling in LLVM libraries.
Hi All, I've been thinking lately about how to improve LLVM's error model and error reporting. A lack of good error reporting in Orc and MCJIT has forced me to spend a lot of time investigating hard-to-debug errors that could easily have been identified if we provided richer error information to the client, rather than just aborting. Kevin Enderby has made similar observations about the