@@ -123,22 +123,42 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
123
123
FLTFirebaseMethodCallErrorBlock errorBlock = ^(
124
124
NSString *_Nullable code, NSString *_Nullable message, NSDictionary *_Nullable details,
125
125
NSError *_Nullable error) {
126
+ NSMutableDictionary *temp;
126
127
if (code == nil ) {
127
128
NSDictionary *errorDetails = getDictionaryFromNSError (error);
128
129
code = errorDetails[kCode ];
129
130
message = errorDetails[kMessage ];
130
- details = errorDetails;
131
+
132
+ if (errorDetails[@" additionalData" ] != nil ) {
133
+ temp = [errorDetails[@" additionalData" ] mutableCopy ];
134
+ } else {
135
+ temp = [errorDetails mutableCopy ];
136
+ }
137
+
138
+ // "NSErrorFailingURLStringKey" key does not work for removing this object. So we use our own
139
+ // String to retrieve
140
+ if (temp[@" NSErrorFailingURLKey" ] != nil ) {
141
+ [temp removeObjectForKey: @" NSErrorFailingURLKey" ];
142
+ }
143
+ if (temp[NSUnderlyingErrorKey ] != nil ) {
144
+ [temp removeObjectForKey: NSUnderlyingErrorKey ];
145
+ }
146
+
147
+ if ([errorDetails[kMessage ] containsString: @" An unknown error has occurred" ] &&
148
+ [temp[NSLocalizedDescriptionKey ] containsString: @" The request timed out" ]) {
149
+ message = temp[NSLocalizedDescriptionKey ];
150
+ }
131
151
132
152
if (errorDetails[@" additionalData" ][NSLocalizedFailureReasonErrorKey ] != nil ) {
133
153
// This stops an uncaught type cast exception in dart
134
- NSMutableDictionary *temp = [errorDetails[@" additionalData" ] mutableCopy ];
135
154
[temp removeObjectForKey: NSLocalizedFailureReasonErrorKey ];
136
- details = temp;
137
155
// provides a useful message to the user. e.g. "Universal link URL could not be parsed".
138
156
if ([message containsString: @" unknown error" ]) {
139
157
message = errorDetails[@" additionalData" ][NSLocalizedFailureReasonErrorKey ];
140
158
}
141
159
}
160
+
161
+ details = temp;
142
162
} else {
143
163
details = @{
144
164
kCode : code,
0 commit comments