Fix failure argument in reportError:

If we create error object and check it after, we should use it in the method.