15
15
import java .util .ArrayList ;
16
16
import java .util .List ;
17
17
18
- public class Extractor implements RequestHandler <String , String > {
18
+ public class Extractor implements RequestHandler <String , Response > {
19
19
private static String lambdaTaskRoot = System .getenv ("LAMBDA_TASK_ROOT" );
20
20
21
- public String handleRequest (String code , Context context ) {
21
+ public Response handleRequest (String code , Context context ) {
22
22
try {
23
23
File tmpDir = Files .createTempDirectory ("me" ).toFile ();
24
24
File sourceFile = new File (tmpDir .toString (), "Main.java" );
@@ -29,9 +29,10 @@ public String handleRequest(String code, Context context) {
29
29
compile (sourceFile );
30
30
run (tmpDir );
31
31
32
- return new String (Files .readAllBytes (Paths .get (tmpDir .toString (), "visualization.json" )));
32
+ String commands = new String (Files .readAllBytes (Paths .get (tmpDir .toString (), "visualization.json" )));
33
+ return new Response (commands );
33
34
} catch (Exception e ) {
34
- return e . getMessage ( );
35
+ return new Response ( e );
35
36
}
36
37
}
37
38
0 commit comments