package me.chyxion.tigon.webmvc.exception;

import me.chyxion.tigon.exception.BaseException;
import org.springframework.core.annotation.Order;

/**
 * @version 0.0.1
 * @since 0.0.1
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * Feb 3, 2015 12:56:38 PM
 */
@Order(32)
public class BaseExceptionResolver extends DefaultExceptionResolver {

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean accept(Throwable ex) {
        return ex instanceof BaseException;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Object getErrorCode(Throwable ex) {
        return ((BaseException) ex).getCode();
    }
}
