Refactor handle_open_channel to wrapper error handling function