Skip to content

Commit

Permalink
Merge pull request #6 from jivesoftware/error-wrapping
Browse files Browse the repository at this point in the history
Addition of ErrorWrappingGlideException for OOM
  • Loading branch information
ihenchi committed Apr 28, 2016
2 parents a52a043 + d00d105 commit a89dda8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import static org.mockito.Mockito.when;

import com.bumptech.glide.Priority;
import com.bumptech.glide.load.engine.exceptions.ErrorWrappingGlideException;
import com.bumptech.glide.request.ResourceCallback;

import org.junit.Before;
Expand Down Expand Up @@ -237,6 +238,6 @@ public void testNotifiesManagerOfFailureIfJobThrowsOOMDecodingFromSource() throw
when(job.decodeFromSource()).thenThrow(expected);
runnable.run();

verify(manager).onException(any(RuntimeException.class));
verify(manager).onException(any(ErrorWrappingGlideException.class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.util.Log;

import com.bumptech.glide.Priority;
import com.bumptech.glide.load.engine.exceptions.ErrorWrappingGlideException;
import com.bumptech.glide.load.engine.executor.Prioritized;
import com.bumptech.glide.request.ResourceCallback;

Expand Down Expand Up @@ -60,7 +61,7 @@ public void run() {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "Out Of Memory Error decoding", e);
}
exception = new RuntimeException(e);
exception = new ErrorWrappingGlideException(e);
} catch (Exception e) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "Exception decoding", e);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.bumptech.glide.load.engine.exceptions;

/**
* An exception class used for wrapping and distinguishing errors such as
* {@link OutOfMemoryError}.
*/
public class ErrorWrappingGlideException extends Exception {
public ErrorWrappingGlideException(Throwable throwable) {
super(throwable);
}
}

0 comments on commit a89dda8

Please sign in to comment.