hasOnErrorSet

Template to determine if hook provides function called when error is set.

@safe
template hasOnErrorSet (
Hook
T
) {
enum hasOnErrorSet;
enum hasOnErrorSet;
}

Examples

1 struct Hook {
2     static string lastErr;
3     static void onErrorSet(E)(auto ref E err) { lastErr = err; }
4 }
5 
6 static assert(hasOnErrorSet!(Hook, string));
7 auto res = err!(int, Hook)("foo");
8 assert(res.hasError);
9 assert(Hook.lastErr == "foo");

Meta