mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Make some error messages localizable (#9811)
* Make error message of 3 exceptions localizable. * Revert unnecessary file handle exception change.
This commit is contained in:
		@@ -3,6 +3,7 @@ package eu.kanade.presentation.util
 | 
			
		||||
import android.content.Context
 | 
			
		||||
import eu.kanade.tachiyomi.R
 | 
			
		||||
import eu.kanade.tachiyomi.network.HttpException
 | 
			
		||||
import eu.kanade.tachiyomi.source.online.LicensedMangaChaptersException
 | 
			
		||||
import tachiyomi.data.source.NoResultsException
 | 
			
		||||
import tachiyomi.domain.source.model.SourceNotInstalledException
 | 
			
		||||
 | 
			
		||||
@@ -13,6 +14,7 @@ val Throwable.formattedMessage: String
 | 
			
		||||
            is NoResultsException -> return getString(R.string.no_results_found)
 | 
			
		||||
            is SourceNotInstalledException -> return getString(R.string.loader_not_implemented_error)
 | 
			
		||||
            is HttpException -> return "$message: ${getString(R.string.http_error_hint)}"
 | 
			
		||||
            is LicensedMangaChaptersException -> return getString(R.string.licensed_manga_chapters_error)
 | 
			
		||||
        }
 | 
			
		||||
        return when (val className = this::class.simpleName) {
 | 
			
		||||
            "Exception", "IOException" -> message ?: className
 | 
			
		||||
 
 | 
			
		||||
@@ -106,10 +106,10 @@ class BackupManager(
 | 
			
		||||
                    UniFile.fromUri(context, uri)
 | 
			
		||||
                }
 | 
			
		||||
                )
 | 
			
		||||
                ?: throw Exception("Couldn't create backup file")
 | 
			
		||||
                ?: throw Exception(context.getString(R.string.create_backup_file_error))
 | 
			
		||||
 | 
			
		||||
            if (!file.isFile) {
 | 
			
		||||
                throw IllegalStateException("Failed to get handle on file")
 | 
			
		||||
                throw IllegalStateException("Failed to get handle on a backup file")
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            val byteArray = parser.encodeToByteArray(BackupSerializer, backup)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user