package jp.dip.arimodoki.cntl;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jp.dip.arimodoki.common.CConst;
@RestController
public class Except implements CConst{
@RequestMapping(value = "/except")
public String except() {
try {
int x = 100 / 0;
} catch(Exception e) {
logger.log_error(e, "try & catch で例外をハンドリングしました");
}
return "exception";
}
@ExceptionHandler(Exception.class)
public String ExceptionHandler(Exception ex) {
logger.log_error(ex, "@ExceptionHandler で例外をハンドリングしました");
return "exception";
}
}
|