From 918d8e883eae61807bbfa36142a113c4f63eedf2 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 28 Aug 2026 18:00:17 +0530 Subject: [PATCH] feat: deliver realtime policy-violation errors to subscription streams Realtime errors were thrown from the websocket message handler; they are now delivered to active subscription streams via addError so consumers can handle them through the subscription's onError. Bumps flutter SDK to 26.1.0. --- CHANGELOG.md | 4 ++++ lib/src/realtime_mixin.dart | 6 +++++- pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce971fd..fe6daaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 26.1.0 + +* Fixed: realtime policy-violation errors are now delivered to active subscription streams instead of thrown from the message handler + ## 26.0.0 * Breaking: `Execution.functionId` replaced by `resourceId` and `resourceType`, now that executions cover both functions and sites diff --git a/lib/src/realtime_mixin.dart b/lib/src/realtime_mixin.dart index 639f279..5ee9caa 100644 --- a/lib/src/realtime_mixin.dart +++ b/lib/src/realtime_mixin.dart @@ -397,7 +397,11 @@ mixin RealtimeMixin { void handleError(RealtimeResponse response) { if (response.data['code'] == status.policyViolation) { - throw AppwriteException(response.data["message"], response.data["code"]); + final error = AppwriteException( + response.data["message"], response.data["code"]); + for (var subscription in _subscriptions.values) { + subscription.controller.addError(error); + } } else { _retry(); } diff --git a/pubspec.yaml b/pubspec.yaml index ee9ee40..3eeb0c8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite -version: 26.0.0 +version: 26.1.0 description: Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-flutter