Skip to content

Commit

Permalink
Added some analytics for Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
below committed Jul 29, 2022
1 parent b0d2edb commit e24f804
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion GeofenceTester/RegionDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import UIKit
import CoreLocation
import os.log
import AppCenterAnalytics

class RegionDetailViewController: UIViewController, Loggable, LocationUser {

Expand Down Expand Up @@ -60,7 +61,9 @@ class RegionDetailViewController: UIViewController, Loggable, LocationUser {
guard let region = locationManager.monitoredRegions.first(where: {
$0.identifier == identifier
}) as? CLCircularRegion else {
logger.error("Unable to find monitored region with identifier \(self.identifier)")
let error = "Unable to find monitored region with identifier \(self.identifier!)"
logger.error("\(error)")
Analytics.trackEvent(error, withProperties: [:], flags: .critical)
return
}

Expand Down
2 changes: 2 additions & 0 deletions GeofenceTester/RegionsListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import UIKit
import MapKit
import os.log
import AppCenterAnalytics

let PausesVisitAutomatically = "PausesVisitAutomatically"

Expand Down Expand Up @@ -155,6 +156,7 @@ class RegionsListViewController: UIViewController {
}

internal func handleError (_ error: String) {
Analytics.trackEvent(error, withProperties: [:], flags: .critical)
logger.error("\(error)")
}

Expand Down

0 comments on commit e24f804

Please sign in to comment.