Commit c55bcc21 by Daniel Dahan

updated Error messaging in CaptureSession

parent 67009dde
...@@ -264,7 +264,11 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -264,7 +264,11 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate {
error = e error = e
} }
} else { } else {
error = NSError(domain: "[MaterialKit Error: Unsupported focusMode.]", code: 0, userInfo: nil) var userInfo: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
userInfo[NSLocalizedDescriptionKey] = "[MaterialKit Error: Unsupported focusMode.]"
userInfo[NSLocalizedFailureReasonErrorKey] = "[MaterialKit Error: Unsupported focusMode.]"
error = NSError(domain: "io.materialkit.CaptureView", code: 1111, userInfo: userInfo)
userInfo[NSUnderlyingErrorKey] = error
} }
if let e: NSError = error { if let e: NSError = error {
delegate?.captureSessionFailedWithError?(self, error: e) delegate?.captureSessionFailedWithError?(self, error: e)
...@@ -291,7 +295,11 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -291,7 +295,11 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate {
error = e error = e
} }
} else { } else {
error = NSError(domain: "[MaterialKit Error: Unsupported flashMode.]", code: 0, userInfo: nil) var userInfo: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
userInfo[NSLocalizedDescriptionKey] = "[MaterialKit Error: Unsupported flashMode.]"
userInfo[NSLocalizedFailureReasonErrorKey] = "[MaterialKit Error: Unsupported flashMode.]"
error = NSError(domain: "io.materialkit.CaptureView", code: 2222, userInfo: userInfo)
userInfo[NSUnderlyingErrorKey] = error
} }
if let e: NSError = error { if let e: NSError = error {
delegate?.captureSessionFailedWithError?(self, error: e) delegate?.captureSessionFailedWithError?(self, error: e)
...@@ -318,7 +326,11 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -318,7 +326,11 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate {
error = e error = e
} }
} else { } else {
error = NSError(domain: "[MaterialKit Error: Unsupported torchMode.]", code: 0, userInfo: nil) var userInfo: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
userInfo[NSLocalizedDescriptionKey] = "[MaterialKit Error: Unsupported torchMode.]"
userInfo[NSLocalizedFailureReasonErrorKey] = "[MaterialKit Error: Unsupported torchMode.]"
error = NSError(domain: "io.materialkit.CaptureView", code: 3333, userInfo: userInfo)
userInfo[NSUnderlyingErrorKey] = error
} }
if let e: NSError = error { if let e: NSError = error {
delegate?.captureSessionFailedWithError?(self, error: e) delegate?.captureSessionFailedWithError?(self, error: e)
...@@ -460,7 +472,11 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -460,7 +472,11 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate {
error = e error = e
} }
} else { } else {
error = NSError(domain: "[MaterialKit Error: Unsupported focusAtPoint.]", code: 0, userInfo: nil) var userInfo: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
userInfo[NSLocalizedDescriptionKey] = "[MaterialKit Error: Unsupported focusAtPoint.]"
userInfo[NSLocalizedFailureReasonErrorKey] = "[MaterialKit Error: Unsupported focusAtPoint.]"
error = NSError(domain: "io.materialkit.CaptureView", code: 4444, userInfo: userInfo)
userInfo[NSUnderlyingErrorKey] = error
} }
if let e: NSError = error { if let e: NSError = error {
delegate?.captureSessionFailedWithError?(self, error: e) delegate?.captureSessionFailedWithError?(self, error: e)
...@@ -486,7 +502,11 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -486,7 +502,11 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate {
error = e error = e
} }
} else { } else {
error = NSError(domain: "[MaterialKit Error: Unsupported exposeAtPoint.]", code: 0, userInfo: nil) var userInfo: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
userInfo[NSLocalizedDescriptionKey] = "[MaterialKit Error: Unsupported exposeAtPoint.]"
userInfo[NSLocalizedFailureReasonErrorKey] = "[MaterialKit Error: Unsupported exposeAtPoint.]"
error = NSError(domain: "io.materialkit.CaptureView", code: 5555, userInfo: userInfo)
userInfo[NSUnderlyingErrorKey] = error
} }
if let e: NSError = error { if let e: NSError = error {
delegate?.captureSessionFailedWithError?(self, error: e) delegate?.captureSessionFailedWithError?(self, error: e)
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> and other CosmicMind contributors // Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment