Inside the UpdatePanel endRequest handler, we can fetch the error message occured at server and prevent further bubbling of error.
HTML
<asp:ScriptManager runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <asp:Button runat="server" Text="Convert" OnClick="ConvertToInt" />
    </ContentTemplate>
</asp:UpdatePanel>
<script type="text/javascript">
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if (prm != null) {
        prm.add_endRequest(function (sender, e) {
            if (sender._postBackSettings.panelsToUpdate != null) {
                alert(e.get_error().message);
                e.set_errorHandled(true);
            }
        });
    };
</script>
Code
protected void ConvertToInt(object sender, EventArgs e)
{
    int a = Convert.ToInt32("a");
}