Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
### ✨ New Features
* Add setAppstackAttributionParams API (#1671) via Rick (@rickvdl)

### 🐞 Bugfixes
* Fix Wasm incompatibility: replace `is JSObject` runtime check with `isA<JSObject>()` in web error processing (#1651)

## 9.13.2
## RevenueCat SDK
### 📦 Dependency Updates
Expand Down
35 changes: 19 additions & 16 deletions lib/web/purchases_flutter_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -453,23 +453,26 @@ class PurchasesFlutterPlugin {
];

PlatformException _processError(dynamic error) {
if (error is JSObject && error.has('code')) {
final errorMap = _convertJsRecordToMap(error);
final code = errorMap['code'];
final message = errorMap['message'];
final underlyingErrorMessage = errorMap['underlyingErrorMessage'];
final finalMessage = '$message. $underlyingErrorMessage';
return PlatformException(
code: '$code',
message: finalMessage,
details: errorMap,
);
} else {
return PlatformException(
code: _unknownErrorCode,
message: error.toString(),
);
final jsAny = error as JSAny?;
if (jsAny != null && jsAny.isA<JSObject>()) {
final jsObject = jsAny as JSObject;
if (jsObject.has('code')) {
final errorMap = _convertJsRecordToMap(jsObject);
final code = errorMap['code'];
final message = errorMap['message'];
final underlyingErrorMessage = errorMap['underlyingErrorMessage'];
final finalMessage = '$message. $underlyingErrorMessage';
return PlatformException(
code: '$code',
message: finalMessage,
details: errorMap,
);
}
}
return PlatformException(
code: _unknownErrorCode,
message: error.toString(),
);
}

Map<String, dynamic> _convertJsRecordToMap(JSAny? jsRecord) {
Expand Down