Skip to content

Commit 385aa88

Browse files
committed
Use throwable in listener signature
1 parent c42cf98 commit 385aa88

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

example/src/main/java/net/ypresto/androidtranscoder/example/TranscoderActivity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import android.widget.Toast;
1313

1414
import net.ypresto.androidtranscoder.MediaTranscoder;
15-
import net.ypresto.androidtranscoder.strategy.DefaultVideoStrategy;
1615
import net.ypresto.androidtranscoder.utils.Logger;
1716

1817
import java.io.File;
@@ -111,7 +110,7 @@ public void onTranscodeCanceled() {
111110
}
112111

113112
@Override
114-
public void onTranscodeFailed(@NonNull Exception exception) {
113+
public void onTranscodeFailed(@NonNull Throwable exception) {
115114
onTranscodeFinished(false, "Transcoder error occurred.");
116115
}
117116
}).transcode();

lib/src/main/java/net/ypresto/androidtranscoder/MediaTranscoder.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public void onProgress(final double progress) {
138138
throw e;
139139
} catch (Throwable e) {
140140
LOG.e("Unexpected error while transcoding", e);
141+
listenerWrapper.onTranscodeFailed(e);
141142
throw e;
142143
}
143144
return null;
@@ -172,11 +173,8 @@ public interface Listener {
172173

173174
/**
174175
* Called when transcode failed.
175-
*
176-
* @param exception Exception thrown from {@link MediaTranscoderEngine#transcode(MediaTranscoderOptions)}.
177-
* Note that it IS NOT {@link java.lang.Throwable}. This means {@link java.lang.Error} won't be caught.
178176
*/
179-
void onTranscodeFailed(@NonNull Exception exception);
177+
void onTranscodeFailed(@NonNull Throwable exception);
180178
}
181179

182180
/**
@@ -220,7 +218,7 @@ public void run() {
220218
}
221219

222220
@Override
223-
public void onTranscodeFailed(@NonNull final Exception exception) {
221+
public void onTranscodeFailed(@NonNull final Throwable exception) {
224222
mHandler.post(new Runnable() {
225223
@Override
226224
public void run() {

0 commit comments

Comments
 (0)