function handleError(error, type = "error") {
    switch (type) {
        case "error":
            console.error(error);
            // disable error timeout, to allow necessary user action
            notify.errorMsg(error.toString(), 0);
            break;

        case "warning":
            notify.warningMsg(error.toString());
            console.warn(error.toString());
            break;

        case "success":
            notify.successMsg(error.toString());
            console.info(error.toString());
            break;

        case "info":
        default:
            notify.infoMsg(error.toString());
            console.info(error.toString());
            break;
    }
}
Handle an error

@since 3.0.0

@param Error error Error object
@param string type Error type