Precheck the error BEFORE the check for memory available.