Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
package com.example.calculator.handler;
-import com.example.calculator.*;
+import com.example.calculator.protocol.*;
import com.example.calculator.service.CalculatorService;
-import org.apache.thrift.TException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-public class CalculatorServiceHandler implements TCalculatorService.Iface {
+public class CalculatorServiceHandler implements TCalculatorService {
CalculatorService calculatorService;
- public int calculate(int num1, int num2, TOperation op) throws TException {
+ public int calculate(int num1, int num2, TOperation op) throws TDivisionByZeroException {
switch(op) {
case ADD:
return calculatorService.add(num1, num2);
@@ -28,7 +28,7 @@ public class CalculatorServiceHandler implements TCalculatorService.Iface {
throw new TDivisionByZeroException();
- throw new TException("Unknown operation " + op);
+ throw new IllegalArgumentException("Unknown operation " + op);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment