API error reporting fix

Very small change to report errors to the caller.