Actually with modern CPU's branch-prediction architectures, you can construct error code checks (any simple, non-loop branches, really) in such a way that they're effectively "free" as long as the code remains on the "expected"/"non-branching" path, and performance in error paths is generally (not always, but generally) moot. Most modern compiler toolchains do so automatically.
The notion that checking for error codes on API returns implies a performance hit hasn't been an accurate assumption for some time now. Obviously, additional checking like range checks, parameter validation, etc. incur performance cost, but simple error code return checks (typically a 0/!0 or !0/0 compare), as well as other such simple, non-loop branches, do not generally impact performance any longer.
I can give the TL ; DR explanation if desired, but if you understand the basics of instruction speculation and branch prediction, you should be able to figure out why for yourselves.
Bookmarks