Skip to content

Commit

Permalink
temorary show the last warning in addition to the last error, just in…
Browse files Browse the repository at this point in the history
… case the core does sth. wrong, might help to get a grip on some weird errors
  • Loading branch information
r10s committed May 14, 2020
1 parent 0119ca7 commit ccf23aa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions DcCore/DcCore/DC/Wrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class DcContext {
public var logger: Logger?
let contextPointer: OpaquePointer
public var lastErrorString: String?
public var lastWarningString: String = "" // temporary thing to get a grip on some weird errors
public var maxConfigureProgress: Int = 0 // temporary thing to get a grip on some weird errors

private init() {
Expand Down Expand Up @@ -294,6 +295,7 @@ public class DcContext {

public func configure() {
maxConfigureProgress = 0
lastWarningString = ""
dc_configure(contextPointer)
}

Expand Down
1 change: 1 addition & 0 deletions DcCore/DcCore/DC/events.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public func callbackSwift(event: CInt, data1: CUnsignedLong, data2: CUnsignedLon

case DC_EVENT_WARNING:
let s = String(cString: data2String)
DcContext.shared.lastWarningString = s
DcContext.shared.logger?.warning("event: \(s)")

case DC_EVENT_CONFIGURE_PROGRESS:
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Controller/AccountSetupController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ class AccountSetupController: UITableViewController, ProgressAlertHandler {
if let appDelegate = UIApplication.shared.delegate as? AppDelegate, appDelegate.reachability.connection == .none {
errorMessage = String.localized("login_error_no_internet_connection")
} else {
errorMessage = "\(errorMessage ?? "no message") (progress=\(DcContext.shared.maxConfigureProgress))"
errorMessage = "\(errorMessage ?? "no message")\n\n(warning=\(DcContext.shared.lastWarningString) (progress=\(DcContext.shared.maxConfigureProgress))"
}
self.updateProgressAlert(error: errorMessage)
} else if ui["done"] as! Bool {
Expand Down

0 comments on commit ccf23aa

Please sign in to comment.