exception_wrapper exception_wrapper::from_exception_ptr( std::exception_ptr const& ptr) noexcept { if (!ptr) { return exception_wrapper(); } try { std::rethrow_exception(ptr); } catch (std::exception& e) { return exception_wrapper(std::current_exception(), e); } catch (...) { return exception_wrapper(std::current_exception()); } }
exception_wrapper SchemaValidator::try_validate(const dynamic& value) const noexcept { try { ValidationContext vc; if (auto se = validate(vc, value)) { return make_exception_wrapper<SchemaError>(*se); } } catch (const std::exception& e) { return exception_wrapper(std::current_exception(), e); } catch (...) { return exception_wrapper(std::current_exception()); } return exception_wrapper(); }
int fostlib::main_exec( const loaded_settings &settings, ostream &out, arguments &args, int (*main_f)( fostlib::ostream &, fostlib::arguments & ) ) { return exception_wrapper( out, boost::bind( simple_wrapper, boost::cref( settings ), boost::ref( out ), boost::ref( args ), main_f ) ); }
IOBufQueue helper<ProtocolReader, ProtocolWriter>::write_exn( const char* method, ProtocolWriter* prot, int32_t protoSeqId, ContextStack* ctx, const TApplicationException& x) { IOBufQueue queue(IOBufQueue::cacheChainLength()); size_t bufSize = x.serializedSizeZC(prot); bufSize += prot->serializedMessageSize(method); prot->setOutput(&queue, bufSize); if (ctx) { ctx->handlerErrorWrapped(exception_wrapper(x)); } prot->writeMessageBegin(method, T_EXCEPTION, protoSeqId); x.write(prot); prot->writeMessageEnd(); return queue; }