- 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`
This commit is contained in:
Tristan B. Velloza Kildaire 2023-03-29 15:57:51 +02:00
parent 8942bd7f85
commit 454e7dd18e
2 changed files with 15 additions and 6 deletions

View File

@ -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;
}
}

View File

@ -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
}
}
}