mirror of
https://github.com/etesync/android
synced 2024-12-23 15:18:14 +00:00
Import: have a user facing error instead of a crash.
This commit is contained in:
parent
b5aafc11c5
commit
db993e81eb
@ -234,9 +234,10 @@ class ImportFragment(private val account: Account, private val uid: String, priv
|
|||||||
|
|
||||||
val localCalendar: LocalCalendar?
|
val localCalendar: LocalCalendar?
|
||||||
try {
|
try {
|
||||||
localCalendar = LocalCalendar.findByName(account, provider, LocalCalendar.Factory, uid!!)
|
localCalendar = LocalCalendar.findByName(account, provider, LocalCalendar.Factory, uid)
|
||||||
if (localCalendar == null) {
|
if (localCalendar == null) {
|
||||||
throw FileNotFoundException("Failed to load local resource.")
|
result.e = FileNotFoundException("Failed to load local resource.")
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
} catch (e: CalendarStorageException) {
|
} catch (e: CalendarStorageException) {
|
||||||
Logger.log.info("Fail" + e.localizedMessage)
|
Logger.log.info("Fail" + e.localizedMessage)
|
||||||
@ -292,9 +293,10 @@ class ImportFragment(private val account: Account, private val uid: String, priv
|
|||||||
provider?.let {
|
provider?.let {
|
||||||
val localTaskList: LocalTaskList?
|
val localTaskList: LocalTaskList?
|
||||||
try {
|
try {
|
||||||
localTaskList = LocalTaskList.findByName(account, it, LocalTaskList.Factory, uid!!)
|
localTaskList = LocalTaskList.findByName(account, it, LocalTaskList.Factory, uid)
|
||||||
if (localTaskList == null) {
|
if (localTaskList == null) {
|
||||||
throw FileNotFoundException("Failed to load local resource.")
|
result.e = FileNotFoundException("Failed to load local resource.")
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
} catch (e: FileNotFoundException) {
|
} catch (e: FileNotFoundException) {
|
||||||
Logger.log.info("Fail" + e.localizedMessage)
|
Logger.log.info("Fail" + e.localizedMessage)
|
||||||
@ -341,9 +343,10 @@ class ImportFragment(private val account: Account, private val uid: String, priv
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
val localAddressBook = LocalAddressBook.findByUid(context, provider, account, uid!!)
|
val localAddressBook = LocalAddressBook.findByUid(context, provider, account, uid)
|
||||||
if (localAddressBook == null) {
|
if (localAddressBook == null) {
|
||||||
throw FileNotFoundException("Failed to load local address book.")
|
result.e = FileNotFoundException("Failed to load local address book.")
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
for (contact in contacts.filter { contact -> !contact.group }) {
|
for (contact in contacts.filter { contact -> !contact.group }) {
|
||||||
|
Loading…
Reference in New Issue
Block a user