CoapClientExcpeiton

- Added new base class for any client-based errors

RequestTimeoutException

- Added new exception type
This commit is contained in:
Tristan B. Velloza Kildaire 2023-09-25 14:08:00 +02:00
parent 123605df99
commit 82ba08b472

View File

@ -0,0 +1,44 @@
module doap.client.exceptions;
import doap.exceptions : CoapException;
import core.time : Duration;
public class CoapClientException : CoapException
{
this(string msg)
{
super(msg);
}
}
import doap.client.request : CoapRequestFuture;
import std.conv : to;
package final class RequestTimeoutException : CoapClientException
{
/**
* The future we timed out on
*/
private CoapRequestFuture future;
/**
* Timeout time
*/
private Duration timeout;
/**
* Constructs a new timeout exception for
* the given future which timed out
*
* Params:
* future = the future we timed out on
* timeout = the time duration timed out
* on
*/
this(CoapRequestFuture future, Duration timeout)
{
super("Timed out whilst waiting for "~to!(string)(future)~" after "~to!(string)(timeout));
this.future = future;
this.timeout = timeout;
}
}