Skip to content

Commit

Permalink
Small updates to logging (#1172)
Browse files Browse the repository at this point in the history
Don't log expected exceptions. Log more data about why directories are
null if they are null.
  • Loading branch information
ahmedre authored May 1, 2019
1 parent 15587da commit 7790b1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ class QuranDataPresenter @Inject internal constructor(
directory?.let {
val log = StringBuilder()

val quranImagesDirectory = quranFileUtils.getQuranImagesBaseDirectory(appContext)
val quranImagesDirectoryFiles = File(quranImagesDirectory).listFiles()
val quranImagesDirectoryName = quranFileUtils.getQuranImagesBaseDirectory(appContext)
val quranImagesDirectory = File(quranImagesDirectoryName)
val quranImagesDirectoryFiles = quranImagesDirectory.listFiles()
quranImagesDirectoryFiles?.let { files ->
val imageSubdirectories = files.filter { it.name.contains("width_") }
imageSubdirectories.map {
Expand All @@ -110,13 +111,13 @@ class QuranDataPresenter @Inject internal constructor(
log.append("\n")

if (imageFiles == null) {
log.append("null image file list")
log.append("null image file list, $it - ${it.isDirectory}")
}
}
}

if (quranImagesDirectoryFiles == null) {
log.append("null list of files in images directory")
log.append("null list of files in images directory: $quranImagesDirectoryName - ${quranImagesDirectory.isDirectory}")
}

val audioDirectory = quranFileUtils.getQuranAudioDirectory(appContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.text.NumberFormat;
import java.util.ArrayList;
Expand Down Expand Up @@ -275,6 +276,8 @@ private Response getImageFromWeb(OkHttpClient okHttpClient,
}
}
}
} catch (InterruptedIOException iioe) {
// do nothing, this is expected if the job is canceled
} catch (IOException ioe) {
Timber.e(ioe, "exception downloading file");
} finally {
Expand Down

0 comments on commit 7790b1d

Please sign in to comment.