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");
Template to determine if hook provides function called when error is set.