Moved to return error instead of getError

This will keep thread errors local to the function called, not global