From b04ba431428702c21479b71f1268c0f19b72ea04 Mon Sep 17 00:00:00 2001 From: Anita Ruangrotsakun <138700973+anitarua@users.noreply.github.com> Date: Tue, 9 Jan 2024 15:33:09 -0800 Subject: [PATCH] chore: error responses should print informative errors by default (#88) * chore: error responses should print informative errors by default * give more time buffer for flaky pubsub test --- lib/src/messages/responses/responses_base.dart | 8 +++++++- test/src/cache/topics_test.dart | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/src/messages/responses/responses_base.dart b/lib/src/messages/responses/responses_base.dart index 1612b2e..35fda64 100644 --- a/lib/src/messages/responses/responses_base.dart +++ b/lib/src/messages/responses/responses_base.dart @@ -1,6 +1,12 @@ import '../../errors/errors.dart'; -class ErrorResponseBase extends AbstractExceptionResponseBase { +class ErrorResponseBase extends AbstractExceptionResponseBase + implements Exception { ErrorResponseBase(SdkException exception) : super(exception.message, exception.errorCode, exception.innerException); + + @override + String toString() { + return "[${super.errorCode}] ${super.message}"; + } } diff --git a/test/src/cache/topics_test.dart b/test/src/cache/topics_test.dart index d9f582c..7002e6f 100644 --- a/test/src/cache/topics_test.dart +++ b/test/src/cache/topics_test.dart @@ -79,7 +79,7 @@ void main() { 'Expected Success but got Error: ${subscribeResp.errorCode} ${subscribeResp.message}'); } - sleep(Duration(seconds: 1)); + sleep(Duration(seconds: 5)); final publishResp = await topicClient.publish( integrationTestCacheName, topicName, StringValue(topicValue)); switch (publishResp) { @@ -90,7 +90,7 @@ void main() { fail( 'Expected Success but got Error: ${publishResp.errorCode} ${publishResp.message}'); } - sleep(Duration(seconds: 1)); + sleep(Duration(seconds: 5)); try { await for (final msg in subscribeResp.stream) {