Move error check into canRead function and use an outer scope variable to report the error condition.