package com.google.research.bleth.servlets;

import com.google.research.bleth.utils.Queries;

import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/** A servlet used for deleting simulations. */
@WebServlet("/delete-simulation")
public class DeleteSimulationServlet extends HttpServlet {

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String simulationId = request.getParameter("simulationId");
        Queries.delete(simulationId);
        response.setContentType("text/html;");
        response.getWriter().println("Simulation has been deleted successfully.");
    }
}

@@ -630,37 +630,242 @@
     
-Queries.delete(simulationId);
+String responseText = %22Simulation has been deleted successfully.%22;%0A        try %7B%0A            Queries.delete(simulationId);%0A        %7D catch (Exception e) %7B%0A            responseText = %22Something went wrong: %22 + e.getMessage();%0A        %7D
 %0A   
@@ -949,51 +949,20 @@
 tln(
-%22Simulation has been deleted successfully.%22
+responseText
 );%0A 

add exceptions handling.