Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ object ISO7816Dispatcher {
return try {
ISO7816CardReader.readCard(tagId, transceiver, appConfigs)
} catch (e: Exception) {
println("[ISO7816Dispatcher] ISO7816 read attempt failed: $e")
null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ object MetrodroidJsonParser {
return try {
ByteUtils.hexStringToByteArray(hex)
} catch (e: Exception) {
println("[MetrodroidJsonParser] Failed to parse hex string: $e")
ByteArray(0)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ class HistoryViewModel(
groupedItems = groupedItems,
)
} catch (e: Throwable) {
println("[HistoryViewModel] Failed to load cards: $e")
e.printStackTrace()
_uiState.value =
_uiState.value.copy(isLoading = false, allItems = emptyList(), groupedItems = emptyList())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class KeysViewModel(
}
_uiState.value = KeysUiState(keys = keys, isLoading = false)
} catch (e: Throwable) {
println("[KeysViewModel] Failed to load keys: $e")
e.printStackTrace()
_uiState.value = KeysUiState(isLoading = false)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class LocalStorageCardKeysPersister(
val raw = lsGetItem(STORAGE_KEY.toJsString())?.toString() ?: return emptyList()
return try {
json.decodeFromString<List<SerializableSavedKey>>(raw).map { it.toSavedKey() }
} catch (_: Exception) {
} catch (e: Exception) {
println("[LocalStorage] Failed to load saved keys: $e")
emptyList()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class LocalStorageCardPersister(
val raw = lsGetItem(STORAGE_KEY.toJsString())?.toString() ?: return emptyList()
return try {
json.decodeFromString<List<SerializableSavedCard>>(raw).map { it.toSavedCard() }
} catch (_: Exception) {
} catch (e: Exception) {
println("[LocalStorage] Failed to load saved cards: $e")
emptyList()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class MdstStationTableReader private constructor(
val (bytes, _) = readDelimitedBytes(data, absoluteOffset)
ProtoBuf.decodeFromByteArray<MdstStation>(bytes)
} catch (e: Exception) {
println("[MdST] Failed to decode station $id: $e")
null
}
}
Expand Down Expand Up @@ -129,6 +130,7 @@ class MdstStationTableReader private constructor(
readers[dbName] = reader
reader
} catch (e: Exception) {
println("[MdST] Failed to parse $dbName: $e")
null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ internal class CEPASProtocol(
)
if (result.isEmpty()) null else result
} catch (ex: ISO7816Exception) {
println("[CEPAS] Failed to read purse $purseId: $ex")
null
}

Expand All @@ -58,6 +59,7 @@ internal class CEPASProtocol(
byteArrayOf(0.toByte()),
)
} catch (ex: ISO7816Exception) {
println("[CEPAS] Failed to read purse history: $ex")
return null
}

Expand All @@ -73,7 +75,7 @@ internal class CEPASProtocol(
)
historyBuff = historyBuff + historyBuff2
} catch (ex: ISO7816Exception) {
// Error reading 2nd purse history
println("[CEPAS] Failed to read 2nd purse history: $ex")
}

return historyBuff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ class PN533FeliCaTagAdapter(
private suspend fun transceiveFelica(felicaFrame: ByteArray): ByteArray? =
try {
pn533.inCommunicateThru(felicaFrame)
} catch (_: Exception) {
} catch (e: Exception) {
println("[PN533FeliCa] Transceive failed: $e")
null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class PCSCFeliCaTagAdapter(
null
}
} catch (e: Exception) {
println("[PCSCFeliCa] Transceive failed: $e")
null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ object ISO7816CardReader {
} catch (e: ISO7816Exception) {
break
} catch (e: Exception) {
println("[ISO7816] Record read failed at SFI $sfi, record $recordNum: $e")
break
}
}
Expand All @@ -181,7 +182,7 @@ object ISO7816CardReader {
try {
binaryData = protocol.readBinary(sfi)
} catch (e: Exception) {
// Ignore - binary read may not be supported for this SFI
println("[ISO7816] Binary read failed for SFI $sfi: $e")
}

return if (records.isNotEmpty() || binaryData != null) {
Expand Down Expand Up @@ -222,6 +223,7 @@ object ISO7816CardReader {
} catch (e: ISOEOFException) {
break
} catch (e: Exception) {
println("[ISO7816] File record read failed: $e")
break
}
}
Expand All @@ -231,13 +233,15 @@ object ISO7816CardReader {
try {
protocol.readBinary()
} catch (e: Exception) {
println("[ISO7816] File binary read failed: $e")
null
}

if (records.isEmpty() && binaryData == null) return null

return ISO7816File(binaryData = binaryData, records = records, fci = fci)
} catch (e: Exception) {
println("[ISO7816] File read failed for app: $e")
return null
}
}
Expand All @@ -260,7 +264,7 @@ object ISO7816CardReader {
)
balances[i] = balance
} catch (e: Exception) {
// Some balances may not be available
println("[ISO7816] Balance read failed: $e")
}
}
return balances
Expand All @@ -280,6 +284,7 @@ object ISO7816CardReader {
4, // BALANCE_RESP_LEN
)
} catch (e: Exception) {
println("[ISO7816] KSX6924 purse info failed: $e")
null
}

Expand All @@ -302,7 +307,7 @@ object ISO7816CardReader {
records.add(record)
}
} catch (e: Exception) {
// Stop at first failure
println("[ISO7816] KSX6924 transaction record read failed: $e")
}
return records
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class ISO7816Protocol(
} catch (e: ISO7816Exception) {
null
} catch (e: Exception) {
println("[ISO7816Protocol] Unexpected error in selectByName: $e")
null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ object ISO7816TLV {
infoBerTLV(header + data, multihead),
)
} catch (e: Exception) {
println("[ISO7816TLV] Failed to build TLV items: $e")
ListItem(id.toHexDump(), data.toHexDump())
}
} else {
Expand All @@ -319,6 +320,7 @@ object ISO7816TLV {
try {
ListItemRecursive(FormattedString("TLV"), null, infoBerTLV(buf))
} catch (e: Exception) {
println("[ISO7816TLV] Failed to decode TLV node: $e")
null
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ object KSX6924Utils {
second = second,
).toInstant(tz)
} catch (e: Exception) {
println("[KSX6924] Failed to parse hex datetime: $e")
null
}
}
Expand All @@ -94,6 +95,7 @@ object KSX6924Utils {
return try {
LocalDate(year = year, month = month, day = day)
} catch (e: Exception) {
println("[KSX6924] Failed to parse hex date: $e")
null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ object VicinityCardReader {
} else {
null
}
} catch (_: Exception) {
} catch (e: Exception) {
println("[VicinityCardReader] Failed to read system info: $e")
null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ object ChinaTransitData {
second = 0,
).toInstant(TZ)
} catch (e: Exception) {
println("[ChinaTransit] Failed to parse hex date from $value: $e")
null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ open class ErgTransitInfo(
if (sector0 !is DataClassicSector) return null
return try {
ErgMetadataRecord.recordFromBytes(sector0.getBlock(2).data)
} catch (_: Exception) {
} catch (e: Exception) {
println("[ERG] Failed to parse metadata record: $e")
null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class LeapTransitFactory : TransitFactory<DesfireCard, TransitInfo> {
val file6 = (app.getFile(6) as StandardDesfireFile).data
TransitIdentity(FormattedString(Res.string.transit_leap_card_name), LeapTransitInfo.getSerial(file2, file6))
} catch (e: Exception) {
println("[Leap] Failed to parse identity: $e")
TransitIdentity(FormattedString(Res.string.transit_leap_card_name), null)
}

Expand Down