| 16 | |
| 17 | template<class T, class Callable, class... Args> |
| 18 | T ExceptionBoundary(BIO* bio, Callable&& f, T err, Args&&... args) noexcept { |
| 19 | try { |
| 20 | return (IO(bio)->*f)(args...); |
| 21 | } catch (...) { |
| 22 | return err; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | int Write(BIO* bio, const char* data, int dlen) noexcept { |
| 27 | return ExceptionBoundary(bio, &TAbstractIO::WriteOld, -1, data, dlen); |