ErrorWithCause: add .code and .domain
This commit is contained in:
parent
d60a3a34bc
commit
934106e837
@ -46,6 +46,8 @@ The `CameraError` type is a baseclass type for all other errors and provides the
|
||||
* `message`: A non-localized message text that provides a more information and context about the error and possibly problematic values.
|
||||
* (optional) `cause`: An `ErrorWithCause` instance that provides information about the cause of the error.
|
||||
* `cause.message`: The message of the error that caused the camera error. This is localized on iOS.
|
||||
* (iOS) `cause.code`: The native error's error-code. (iOS only)
|
||||
* (iOS) `cause.domain`: The native error's domain. (iOS only)
|
||||
* (iOS) `cause.details`: More dictionary-style information about the cause. (iOS only)
|
||||
* (Android) `cause.stacktrace`: A native Java stacktrace for the cause.
|
||||
* (optional) `cause.cause`: The cause that caused the given error. (Recursive)
|
||||
|
@ -463,7 +463,12 @@ final class CameraView: UIView {
|
||||
|
||||
var causeDictionary: [String: Any]?
|
||||
if let cause = cause {
|
||||
causeDictionary = ["message": cause.localizedDescription, "details": cause.userInfo]
|
||||
causeDictionary = [
|
||||
"code": cause.code,
|
||||
"domain": cause.domain,
|
||||
"message": cause.localizedDescription,
|
||||
"details": cause.userInfo
|
||||
]
|
||||
}
|
||||
onError([
|
||||
"code": error.code,
|
||||
|
@ -37,6 +37,20 @@ export type SystemError = 'system/no-camera-manager';
|
||||
export type UnknownError = 'unknown/unknown';
|
||||
|
||||
export interface ErrorWithCause {
|
||||
/**
|
||||
* The native error's code.
|
||||
*
|
||||
* * iOS: `NSError.code`
|
||||
* * Android: N/A
|
||||
*/
|
||||
code?: number;
|
||||
/**
|
||||
* The native error's domain.
|
||||
*
|
||||
* * iOS: `NSError.domain`
|
||||
* * Android: N/A
|
||||
*/
|
||||
domain?: string;
|
||||
/**
|
||||
* The native error description (Localized on iOS)
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user