package com.icloud.server.web.err;

import com.icloud.server.web.json.JsonResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ControllerExceptionHandler  {

    @ExceptionHandler(ServicerunException.class)
    @ResponseBody
    public JsonResult handleServiceException(
            ServicerunException e){
        e.printStackTrace();
        System.out.println(e);
        JsonResult jsonResult = new JsonResult(e);
        jsonResult.setState(0);
//        this.State=201;
//        this.message=e.getMessage();

        return jsonResult;

    }

}
