Skip to content
Snippets Groups Projects
Commit 4985e63b authored by Amalie Nystuen's avatar Amalie Nystuen
Browse files

Endringer i CalculatorResource

parent 388e3285
No related branches found
No related tags found
No related merge requests found
Pipeline #114982 passed
package resources;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
/**
......@@ -42,7 +39,7 @@ public class CalculatorResource {
else if(expressionTrimmed.matches("^\\d+(?:\\s*[*]\\s*\\d+)*$")) result = multiplication(expressionTrimmed);
else if(expressionTrimmed.matches( "^\\d+(?:\\s*[/]\\s*\\d+)*$")) result = division(expressionTrimmed);
else{
throw new IllegalArgumentException("Du må skrive i riktig format");
throw new NotSupportedException("Du må skrive i riktig format");
}
return result;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment