mirror of https://github.com/renaissanceorg/dante
parent
0d5b7c42e4
commit
455bd6fa06
|
@ -0,0 +1,27 @@
|
|||
module dante.tings;
|
||||
|
||||
import dante;
|
||||
import dante.exceptions : ProtocolException;
|
||||
import davinci.base : Command;
|
||||
public mixin template Expect_n_handle(ExpectedType, alias command)
|
||||
if(__traits(isSame, typeof(command), Command))
|
||||
{
|
||||
/**
|
||||
* Check that we can cast to `ExpectedType`
|
||||
*
|
||||
* If not, we throw anexception
|
||||
*/
|
||||
ExpectedType expectedMessage = cast(ExpectedType)command;
|
||||
|
||||
|
||||
|
||||
void Expect_n_handle()
|
||||
{
|
||||
import std.stdio : writeln;
|
||||
writeln("Hello testing");
|
||||
if(expectedMessage is null)
|
||||
{
|
||||
throw ProtocolException.expectedMessageKind(expectedMessage.classinfo, command);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue