jinpengyong
2020-09-17 8b0501f73b6d92b611c7df74535566f65faa7d7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.moral.common.exceptionHandler;
 
import com.moral.common.exception.WebAuthException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
 
import java.util.HashMap;
import java.util.Map;
 
@RestControllerAdvice
public class WebAuthExceptionHandler {
    @ExceptionHandler(WebAuthException.class)
    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
    public Map<String,Object> handlerWebAuthException(WebAuthException e){
        Map<String,Object> result = new HashMap<>();
        result.put("msg",e.getMessage());
        result.put("accountId", -1);
        return result;
    }
}