Fix if: from ex
Add "on_error" callback on protocol and channel
Code cleanup (duplicate methods)