Skip to content

Commit 8a80280

Browse files
david-allisonmikehardy
authored andcommitted
docs: MediaRegistration errors
1 parent 6adee66 commit 8a80280

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/MediaRegistration.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,21 @@ object MediaRegistration {
4444
* Represents different types of media errors.
4545
*/
4646
sealed class MediaError {
47+
/** [Something wrong wrong][R.string.multimedia_editor_something_wrong] */
4748
data object GenericError : MediaError()
4849

50+
/** [Error converting clipboard image to png][R.string.multimedia_editor_png_paste_error] */
4951
class ConversionError(
5052
val message: String,
5153
) : MediaError()
5254

55+
/** [The image is too large, please insert the image manually][R.string.note_editor_image_too_large] */
5356
data object ImageTooLarge : MediaError()
5457

58+
/** [The video file is too large, please insert the video manually][R.string.note_editor_video_too_large] */
5559
data object VideoTooLarge : MediaError()
5660

61+
/** [The audio file is too large, please insert the audio manually][R.string.note_editor_audio_too_large] */
5762
data object AudioTooLarge : MediaError()
5863

5964
fun toHumanReadableString(context: Context): String =
@@ -144,6 +149,8 @@ object MediaRegistration {
144149
* Loads media into the collection.media directory and returns a HTML reference
145150
* @param uri The uri of the image to load
146151
* @return HTML referring to the loaded image
152+
*
153+
* @throws OutOfMemoryError if the file could not be copied to a contiguous block of memory (or is >= 2GB)
147154
*/
148155
// TODO: remove the Android dependencies and handle them outside the method
149156
@Throws(IOException::class)
@@ -222,6 +229,9 @@ object MediaRegistration {
222229
return true
223230
}
224231

232+
/**
233+
* @throws OutOfMemoryError if the file could not be copied to a contiguous block of memory (or is >= 2GB)
234+
*/
225235
@CheckResult
226236
fun registerMediaForWebView(mediaPath: File?): Boolean {
227237
if (mediaPath == null) {

0 commit comments

Comments
 (0)