All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.gjing.AlitxExceptionHandler Maven / Gradle / Ivy

The newest version!
package cn.gjing;

import com.google.common.collect.Maps;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author Gjing
 **/
@ControllerAdvice
@ResponseBody
public class AlitxExceptionHandler {

    @ExceptionHandler(SmsException.class)
    public ResponseEntity smsException(SmsException e) {
        e.printStackTrace();
        return ResponseEntity.badRequest().body(Maps.immutableEntry("msg", e.getMessage()));

    }

    @ExceptionHandler(OssException.class)
    public ResponseEntity ossException(OssException e) {
        e.printStackTrace();
        return ResponseEntity.badRequest().body(Maps.immutableEntry("msg", e.getMessage()));

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy