mirror of
https://github.com/deavmi/doap
synced 2024-07-04 15:50:15 +02:00
CoapClientExcpeiton
- Added new base class for any client-based errors RequestTimeoutException - Added new exception type
This commit is contained in:
parent
123605df99
commit
82ba08b472
44
source/doap/client/exceptions.d
Normal file
44
source/doap/client/exceptions.d
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user