Show installation succeeded when Curse modpack not finished completion

This commit is contained in:
huanghongxun
2018-11-25 17:00:12 +08:00
parent b273c80a02
commit 9c7795687f
10 changed files with 89 additions and 11 deletions

View File

@@ -0,0 +1,36 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2018 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hmcl.task;
import java.io.IOException;
import java.net.URL;
public class DownloadException extends IOException {
private final URL url;
public DownloadException(URL url, Throwable cause) {
super("Unable to download " + url + ", " + cause.getMessage(), cause);
this.url = url;
}
public URL getUrl() {
return url;
}
}

View File

@@ -19,7 +19,8 @@ package org.jackhuang.hmcl.task;
import org.jackhuang.hmcl.event.EventManager;
import org.jackhuang.hmcl.event.FailedEvent;
import org.jackhuang.hmcl.util.*;
import org.jackhuang.hmcl.util.CacheRepository;
import org.jackhuang.hmcl.util.Logging;
import org.jackhuang.hmcl.util.io.ChecksumMismatchException;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.io.IOUtils;
@@ -328,7 +329,7 @@ public class FileDownloadTask extends Task {
}
if (exception != null)
throw new IOException("Unable to download file " + currentURL + ". " + exception.getMessage(), exception);
throw new DownloadException(currentURL, exception);
}
}

View File

@@ -29,7 +29,6 @@ import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.logging.Level;
@@ -141,7 +140,7 @@ public final class GetTask extends TaskResult<String> {
}
}
if (exception != null)
throw exception;
throw new DownloadException(url, exception);
}
/**