Use failIfThrows for spam reporting tokens
This commit is contained in:
parent
0949136fb2
commit
2795e070b2
@ -38,8 +38,10 @@ public struct SpamReportingTokenRecord: Codable, FetchableRecord, PersistableRec
|
||||
public static func reportingToken(
|
||||
for sourceAci: Aci,
|
||||
database: Database,
|
||||
) throws -> SpamReportingToken? {
|
||||
try Self.fetchOne(database, key: sourceAci.rawUUID)?.spamReportingToken
|
||||
) -> SpamReportingToken? {
|
||||
return failIfThrows {
|
||||
return try Self.fetchOne(database, key: sourceAci.rawUUID)
|
||||
}?.spamReportingToken
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -189,15 +189,7 @@ public enum ReportSpamUIUtils {
|
||||
owsFailDebug("Failed to lookup guids to report \(error)")
|
||||
}
|
||||
|
||||
var reportingToken: SpamReportingToken?
|
||||
do {
|
||||
reportingToken = try SpamReportingTokenRecord.reportingToken(
|
||||
for: aci,
|
||||
database: tx.database,
|
||||
)
|
||||
} catch {
|
||||
owsFailBeta("Failed to look up spam reporting token. Continuing on, as the parameter is optional. Error: \(error)")
|
||||
}
|
||||
let reportingToken = SpamReportingTokenRecord.reportingToken(for: aci, database: tx.database)
|
||||
|
||||
guard !guidsToReport.isEmpty else {
|
||||
Logger.warn("No messages with serverGuids to report.")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user