      - parameter feedback:      The feedback that’s just been sent.
      */
     func pinpointKit(_ pinpointKit: PinpointKit, didSend feedback: Feedback)
+    
+    /**
+     Notifies the delegate that PinpointKit has failed to send user feedback.
+     
+     - parameter pinpointKit:   The `PinpointKit` instance responsible for the feedback.
+     - parameter feedback:      The feedback that failed to send.
+     - parameter error:         The error that occurred.
+     */
+    func pinpointKit(_ pinpointKit: PinpointKit, didFailToSend feedback: Feedback, error: Error)
 }
 
 /// An extension on PinpointKitDelegate that makes all delegate methods optional by giving them empty implementations by default.

    
    func pinpointKit(_ pinpointKit: PinpointKit, willSend feedback: Feedback) {}
    func pinpointKit(_ pinpointKit: PinpointKit, didSend feedback: Feedback) {}
}

    public func sender(_ sender: Sender, didFailToSend feedback: Feedback?, error: Error) {
        if case MailSender.Error.mailCanceled = error { return }
        
        let alert = UIAlertController(
            title: "Mailer error",
            message: "Unable to prepare an email to send. Ensure that you have at least one email account set up.",
            preferredStyle: UIAlertControllerStyle.alert)
        
        let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)
        alert.addAction(okAction)
        
        self.configuration.feedbackCollector.viewController.present(alert, animated: true, completion: nil)
        
        guard let feedback = feedback else { return }
        delegate?.pinpointKit(self, didFailToSend: feedback, error: error)
    }
}

