mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-24 23:47:42 +01:00
Change to handle json parse exception instead of xml.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
27465a086d
commit
ada94dc24f
@ -12,7 +12,7 @@ sourceSets {
|
||||
dependencies {
|
||||
api other.kotlinStdlib
|
||||
api other.retrofit
|
||||
implementation other.jacksonConverter
|
||||
api other.jacksonConverter
|
||||
implementation(other.jacksonKotlin) {
|
||||
exclude module: 'kotlin-reflect'
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ import android.app.Activity;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import org.moire.ultrasonic.R;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
|
||||
import org.moire.ultrasonic.R;
|
||||
import org.moire.ultrasonic.service.parser.SubsonicRESTException;
|
||||
import org.moire.ultrasonic.subsonic.RestErrorMapper;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@ -82,16 +82,15 @@ public abstract class BackgroundTask<T> implements ProgressListener
|
||||
return activity.getResources().getString(R.string.background_task_not_found);
|
||||
}
|
||||
|
||||
if (error instanceof IOException)
|
||||
if (error instanceof JsonParseException) {
|
||||
return activity.getResources().getString(R.string.background_task_parse_error);
|
||||
}
|
||||
|
||||
if (error instanceof IOException)
|
||||
{
|
||||
return activity.getResources().getString(R.string.background_task_network_error);
|
||||
}
|
||||
|
||||
if (error instanceof XmlPullParserException)
|
||||
{
|
||||
return activity.getResources().getString(R.string.background_task_parse_error);
|
||||
}
|
||||
|
||||
if (error instanceof SubsonicRESTException) {
|
||||
return RestErrorMapper.getLocalizedErrorMessage((SubsonicRESTException) error, activity);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user