Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
dfcb906d
authored
Jan 06, 2022
by
hschlueter
Committed by
Oliver Woodman
Jan 07, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Wrap PlaybackExceptions in TransformationExceptions.
PiperOrigin-RevId: 420032157
parent
a8e44294
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformationException.java
library/transformer/src/test/java/com/google/android/exoplayer2/transformer/TransformerTest.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformationException.java
View file @
dfcb906d
...
...
@@ -284,17 +284,18 @@ public final class TransformationException extends Exception {
}
/**
* C
onverts a {@link PlaybackException} to a {@code Transformation
Exception}.
* C
reates an instance for a {@link Playback
Exception}.
*
* <p>If no corresponding error code exists, the created instance will have {@link
* #ERROR_CODE_UNSPECIFIED}.
* <p>If there is a corresponding {@link TransformationException.ErrorCode} for the {@link
* PlaybackException.ErrorCode}, this error code and the same message are used for the created
* instance. Otherwise, this is equivalent to {@link #createForUnexpected(Exception)}.
*/
/* package */
static
TransformationException
createForPlaybackException
(
PlaybackException
exception
)
{
return
new
TransformationException
(
exception
.
getMessage
(),
exception
.
getCause
(),
getErrorCodeForName
(
exception
.
getErrorCodeName
())
);
@ErrorCode
int
errorCode
=
getErrorCodeForName
(
exception
.
getErrorCodeName
());
return
errorCode
==
ERROR_CODE_UNSPECIFIED
?
createForUnexpected
(
exception
)
:
new
TransformationException
(
exception
.
getMessage
(),
exception
,
errorCode
);
}
/** An error code which identifies the cause of the transformation failure. */
...
...
library/transformer/src/test/java/com/google/android/exoplayer2/transformer/TransformerTest.java
View file @
dfcb906d
...
...
@@ -340,7 +340,8 @@ public final class TransformerTest {
transformer
.
startTransformation
(
mediaItem
,
outputPath
);
TransformationException
exception
=
TransformerTestRunner
.
runUntilError
(
transformer
);
assertThat
(
exception
).
hasCauseThat
().
isInstanceOf
(
IOException
.
class
);
assertThat
(
exception
).
hasCauseThat
().
hasCauseThat
().
isInstanceOf
(
IOException
.
class
);
assertThat
(
exception
.
errorCode
).
isEqualTo
(
TransformationException
.
ERROR_CODE_IO_FILE_NOT_FOUND
);
}
@Test
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment