From 1405891985054b012ad0a56a588861295751934f Mon Sep 17 00:00:00 2001 From: Ahmed Zamil Date: Sun, 23 Feb 2020 12:54:01 +0300 Subject: [PATCH] Exceptions --- lib/src/Core/AsyncQueue.dart | 1 + lib/src/Core/AsyncReply.dart | 5 +++++ lib/src/Core/ExceptionCode.dart | 2 ++ lib/src/Net/IIP/DistributedConnection.dart | 6 +++--- pubspec.yaml | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/src/Core/AsyncQueue.dart b/lib/src/Core/AsyncQueue.dart index 4c76435..18d1687 100644 --- a/lib/src/Core/AsyncQueue.dart +++ b/lib/src/Core/AsyncQueue.dart @@ -33,6 +33,7 @@ class AsyncQueue extends AsyncReply if (_list[i].ready) { super.trigger(_list[i].result); + super.ready = false; _list.removeAt(i); i--; } diff --git a/lib/src/Core/AsyncReply.dart b/lib/src/Core/AsyncReply.dart index 1fe5eb1..1c785de 100644 --- a/lib/src/Core/AsyncReply.dart +++ b/lib/src/Core/AsyncReply.dart @@ -50,6 +50,11 @@ class AsyncReply implements Future return _resultReady; } + set ready(value) + { + _resultReady = value; + } + T get result { return _result; diff --git a/lib/src/Core/ExceptionCode.dart b/lib/src/Core/ExceptionCode.dart index 09f8bd2..5d610ec 100644 --- a/lib/src/Core/ExceptionCode.dart +++ b/lib/src/Core/ExceptionCode.dart @@ -3,6 +3,8 @@ enum ExceptionCode { HostNotReachable, AccessDenied, + UserNotFound, + ChallengeFailed, ResourceNotFound, AttachDenied, InvalidMethod, diff --git a/lib/src/Net/IIP/DistributedConnection.dart b/lib/src/Net/IIP/DistributedConnection.dart index 4b1266f..fb1251b 100644 --- a/lib/src/Net/IIP/DistributedConnection.dart +++ b/lib/src/Net/IIP/DistributedConnection.dart @@ -732,9 +732,9 @@ class DistributedConnection extends NetworkConnection with IStore { sendParams() .addUint8(0xc0) - .addUint8(1) - .addUint16(5) - .addString("Error") + .addUint8(ExceptionCode.ChallengeFailed.index) + .addUint16(16) + .addString("Challenge Failed") .done(); //SendParams((byte)0xc0, 1, 5, DC.ToBytes("Error")); diff --git a/pubspec.yaml b/pubspec.yaml index 5f2abce..d422b38 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: esyur description: Distributed Object Framework. -version: 1.1.4 +version: 1.1.5 author: Ahmed Zamil homepage: https://github.com/esyur/esyur-dart