Improve error message getting dim size