Remove duplicated code in minErr.js