Install some basic error handling in Dispatch.
[jrw.git] / src / jrw / JagiWrapper.java
CommitLineData
3e20c35c
FT
1package jrw;
2
3import java.util.*;
4import java.util.function.*;
5
6public abstract class JagiWrapper implements Handler, Function<Map<Object, Object>, Map<Object, Object>> {
7 public Map<Object, Object> apply(Map<Object, Object> env) {
d3d92d6c 8 return(Dispatch.handle(this, new Request(env)));
3e20c35c
FT
9 }
10
11 public static JagiWrapper of(Handler handler) {
12 return(new JagiWrapper() {
13 public Map<Object, Object> handle(Request req) {
14 return(handler.handle(req));
15 }
16 });
17 }
18}