export default function (errors, errorDiv, mainDiv) { mainDiv = mainDiv || document; // check if we have any actual errors if (errors === undefined || errors === null) { return; } // Turn OResult into array of errors. if (errors.errorMsg) { errors = [errors.errorMsg]; } // Turn OResults into array of errors. if (errors.OResults) { errors = errors.OResults; } // Prepend the main div with the new error div if one does not exist. if ($(errorDiv, mainDiv).length < 1) { $(mainDiv).prepend('
'); } // Reset the error div. $(errorDiv, mainDiv).html('