From 454e7dd18e5e2ebc04c79081ddafe75ae62de487 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Wed, 29 Mar 2023 15:57:51 +0200 Subject: [PATCH] Watcher - Moved TODO below already completed code Exceptions - Renamed `Error` to `ErrorType` - Constructing a new `TristanableException` will now store the passed in `ErrorType` - Added `getError()` to `TristanableException` which returns the stored `ErrorType` - Added two new memebrs to enum `ErrorType`, namely `QUEUE_NOT_FOUND` and `QUEUE_ALREADY_EXISTS` --- source/tristanable/exceptions.d | 17 ++++++++++++++--- source/tristanable/manager/watcher.d | 4 +--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/source/tristanable/exceptions.d b/source/tristanable/exceptions.d index 0e7926c..399bb1a 100644 --- a/source/tristanable/exceptions.d +++ b/source/tristanable/exceptions.d @@ -1,15 +1,26 @@ module tristanable.exceptions; -public enum Error +public enum ErrorType { - QueueExists + QueueExists, + QUEUE_NOT_FOUND, + QUEUE_ALREADY_EXISTS } public class TristanableException : Exception { - this(Error err) + private ErrorType err; + + this(ErrorType err) { // TODO: Do this super("TODO: Do this"); + + this.err = err; + } + + public ErrorType getError() + { + return err; } } \ No newline at end of file diff --git a/source/tristanable/manager/watcher.d b/source/tristanable/manager/watcher.d index ef28e49..67272d4 100644 --- a/source/tristanable/manager/watcher.d +++ b/source/tristanable/manager/watcher.d @@ -44,8 +44,6 @@ public class Watcher : Thread { while(true) { - // TODO: Implement me - /* Do a bformat read-and-decode */ byte[] wireTristan; receiveMessage(socket, wireTristan); @@ -53,7 +51,7 @@ public class Watcher : Thread /* Decode the received bytes into a tagged message */ TaggedMessage decodedMessage = TaggedMessage.decode(wireTristan); - + // TODO: Implement me } } } \ No newline at end of file