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

com.fastchar.extjs.systemtool.provider.FastExceptionProvider Maven / Gradle / Ivy

The newest version!
package com.fastchar.extjs.systemtool.provider;

import com.fastchar.core.FastChar;
import com.fastchar.extjs.systemtool.FastSystemToolConfig;
import com.fastchar.extjs.systemtool.entity.FinalLogExceptionEntity;
import com.fastchar.interfaces.IFastException;
import com.fastchar.utils.FastStringUtils;
/**
 * @author 沈建(Janesen)
 * @date 2021/5/15 18:11
 */
public class FastExceptionProvider implements IFastException {

    @Override
    public boolean onPrintException(Throwable throwable) {
        if (!FastChar.getConstant().isWebStarted()) {
            return false;
        }
        if (FastChar.getConstant().isWebStopped()) {
            return false;
        }
        FinalLogExceptionEntity exceptionEntity = FinalLogExceptionEntity.newInstance();
        exceptionEntity.set("exception", FastStringUtils.toThrowableInfo(throwable));
        if (exceptionEntity.save()) {
            FinalLogExceptionEntity.dao().clearData(FastChar.getConfig(FastSystemToolConfig.class).getLogExceptionMaxKeepDay());
        }
        return false;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy