http2: better return code error checking