refactor errorhandler
This commit is contained in:
@@ -35,9 +35,10 @@ import java.nio.file.StandardCopyOption;
|
||||
|
||||
import itdelatrisu.opsu.ui.Colors;
|
||||
import org.newdawn.slick.util.Log;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
import yugecin.opsudance.events.BubNotifListener;
|
||||
|
||||
import static yugecin.opsudance.core.errorhandling.ErrorHandler.*;
|
||||
|
||||
/**
|
||||
* File download.
|
||||
*/
|
||||
@@ -144,7 +145,7 @@ public class Download {
|
||||
this.url = new URL(remoteURL);
|
||||
} catch (MalformedURLException e) {
|
||||
this.status = Status.ERROR;
|
||||
ErrorHandler.error(String.format("Bad download URL: '%s'", remoteURL), e).show();
|
||||
explode(String.format("Bad download URL: '%s'", remoteURL), e, DEFAULT_OPTIONS);
|
||||
return;
|
||||
}
|
||||
this.localPath = localPath;
|
||||
@@ -421,7 +422,7 @@ public class Download {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
this.status = Status.ERROR;
|
||||
ErrorHandler.error("Failed to cancel download.", e).show();
|
||||
explode("Failed to cancel download.", e, DEFAULT_OPTIONS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.newdawn.slick.util.Log;
|
||||
import org.newdawn.slick.util.ResourceLoader;
|
||||
import yugecin.opsudance.core.Constants;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
import yugecin.opsudance.events.BarNotifListener;
|
||||
|
||||
import static yugecin.opsudance.core.errorhandling.ErrorHandler.*;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
|
||||
/**
|
||||
@@ -291,7 +291,7 @@ public class Updater {
|
||||
pb.start();
|
||||
} catch (IOException e) {
|
||||
status = Status.INTERNAL_ERROR;
|
||||
ErrorHandler.error("Failed to start new process.", e).show();
|
||||
explode("Failed to start new process.", e, DEFAULT_OPTIONS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@ import java.util.Date;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
|
||||
import static yugecin.opsudance.core.errorhandling.ErrorHandler.*;
|
||||
|
||||
/**
|
||||
* Download server: http://bloodcat.com/osu/
|
||||
@@ -95,7 +96,7 @@ public class BloodcatServer extends DownloadServer {
|
||||
resultCount++;
|
||||
this.totalResults = resultCount;
|
||||
} catch (MalformedURLException | UnsupportedEncodingException e) {
|
||||
ErrorHandler.error(String.format("Problem loading result list for query '%s'.", query), e).show();
|
||||
explode(String.format("Problem loading result list for query '%s'.", query), e, DEFAULT_OPTIONS);
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ import java.net.URLEncoder;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
|
||||
import static yugecin.opsudance.core.errorhandling.ErrorHandler.*;
|
||||
|
||||
/**
|
||||
* Download server: https://osu.hexide.com/
|
||||
@@ -126,7 +127,7 @@ public class HexideServer extends DownloadServer {
|
||||
// all results at once; this approach just gets pagination correct.
|
||||
this.totalResults = arr.length() + resultIndex;
|
||||
} catch (MalformedURLException | UnsupportedEncodingException e) {
|
||||
ErrorHandler.error(String.format("Problem loading result list for query '%s'.", query), e).show();
|
||||
explode(String.format("Problem loading result list for query '%s'.", query), e, DEFAULT_OPTIONS);
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ import java.net.URLEncoder;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
|
||||
import static yugecin.opsudance.core.errorhandling.ErrorHandler.*;
|
||||
|
||||
/**
|
||||
* Download server: http://osu.mengsky.net/
|
||||
@@ -98,7 +99,7 @@ public class MengSkyServer extends DownloadServer {
|
||||
}
|
||||
this.totalResults = resultCount;
|
||||
} catch (MalformedURLException | UnsupportedEncodingException e) {
|
||||
ErrorHandler.error(String.format("Problem loading result list for query '%s'.", query), e).show();
|
||||
explode(String.format("Problem loading result list for query '%s'.", query), e, DEFAULT_OPTIONS);
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package itdelatrisu.opsu.downloads.servers;
|
||||
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.downloads.DownloadNode;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
@@ -32,6 +31,8 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static yugecin.opsudance.core.errorhandling.ErrorHandler.*;
|
||||
|
||||
/**
|
||||
* Download server: http://osu.uu.gl/
|
||||
*/
|
||||
@@ -118,7 +119,7 @@ public class MnetworkServer extends DownloadServer {
|
||||
// store total result count
|
||||
this.totalResults = nodes.length;
|
||||
} catch (MalformedURLException | UnsupportedEncodingException e) {
|
||||
ErrorHandler.error(String.format("Problem loading result list for query '%s'.", query), e).show();
|
||||
explode(String.format("Problem loading result list for query '%s'.", query), e, DEFAULT_OPTIONS);
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ import java.util.TimeZone;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
|
||||
import static yugecin.opsudance.core.errorhandling.ErrorHandler.*;
|
||||
|
||||
/**
|
||||
* Download server: http://loli.al/
|
||||
@@ -121,7 +122,7 @@ public class OsuMirrorServer extends DownloadServer {
|
||||
else
|
||||
this.totalResults = maxServerID;
|
||||
} catch (MalformedURLException | UnsupportedEncodingException e) {
|
||||
ErrorHandler.error(String.format("Problem loading result list for query '%s'.", query), e).show();
|
||||
explode(String.format("Problem loading result list for query '%s'.", query), e, DEFAULT_OPTIONS);
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
|
||||
import static yugecin.opsudance.core.errorhandling.ErrorHandler.*;
|
||||
|
||||
/**
|
||||
* Download server: http://osu.yas-online.net/
|
||||
@@ -112,7 +113,8 @@ public class YaSOnlineServer extends DownloadServer {
|
||||
String downloadLink = item.getString("downloadLink");
|
||||
return String.format(DOWNLOAD_FETCH_URL, downloadLink);
|
||||
} catch (MalformedURLException | UnsupportedEncodingException e) {
|
||||
ErrorHandler.error(String.format("Problem retrieving download URL for beatmap '%d'.", beatmapSetID), e).show();
|
||||
explode(String.format("Problem retrieving download URL for beatmap '%d'.", beatmapSetID), e,
|
||||
DEFAULT_OPTIONS);
|
||||
return null;
|
||||
} finally {
|
||||
Utils.setSSLCertValidation(true);
|
||||
@@ -184,7 +186,7 @@ public class YaSOnlineServer extends DownloadServer {
|
||||
else
|
||||
this.totalResults = maxServerID;
|
||||
} catch (MalformedURLException | UnsupportedEncodingException e) {
|
||||
ErrorHandler.error(String.format("Problem loading result list for query '%s'.", query), e).show();
|
||||
explode(String.format("Problem loading result list for query '%s'.", query), e, DEFAULT_OPTIONS);
|
||||
} finally {
|
||||
Utils.setSSLCertValidation(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user