Search in sources :

Example 26 with NulsException

use of io.nuls.core.exception.NulsException in project nuls by nuls-io.

the class Log method info.

/**
 * 提供info级别基本的日志输出
 *
 * @param msg       需要显示的消息
 * @param throwable 异常信息
 */
public static void info(String msg, Throwable throwable) {
    String logContent = isStringBlank(getId()) ? (getLogTrace() + ":" + msg) : (getLogTrace() + "[" + getId() + "]" + ":" + msg);
    if (!(throwable instanceof NulsException) || !(throwable instanceof NulsRuntimeException)) {
        throwable = new NulsException(ErrorCode.FAILED, throwable);
    }
    LOG.info(logContent, throwable);
}
Also used : NulsException(io.nuls.core.exception.NulsException) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 27 with NulsException

use of io.nuls.core.exception.NulsException in project nuls by nuls-io.

the class Log method debug.

/**
 * 提供debug级别基本的日志输出
 *
 * @param msg       需要显示的消息
 * @param throwable 异常信息
 */
public static void debug(String msg, Throwable throwable) {
    if (LOG.isDebugEnabled()) {
        String logContent = isStringBlank(getId()) ? (getLogTrace() + ":" + msg) : (getLogTrace() + "[" + getId() + "]" + ":" + msg);
        if (!(throwable instanceof NulsException) || !(throwable instanceof NulsRuntimeException)) {
            throwable = new NulsException(ErrorCode.FAILED, throwable);
        }
        LOG.debug(logContent, throwable);
    }
}
Also used : NulsException(io.nuls.core.exception.NulsException) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 28 with NulsException

use of io.nuls.core.exception.NulsException in project nuls by nuls-io.

the class MsgLog method info.

/**
 * 提供info级别基本的日志输出
 *
 * @param msg       需要显示的消息
 * @param throwable 异常信息
 */
public static void info(String msg, Throwable throwable) {
    String logContent = isStringBlank(getId()) ? (getLogTrace() + ":" + msg) : (getLogTrace() + "[" + getId() + "]" + ":" + msg);
    if (!(throwable instanceof NulsException) || !(throwable instanceof NulsRuntimeException)) {
        throwable = new NulsException(ErrorCode.FAILED, throwable);
    }
    LOG.info(logContent, throwable);
}
Also used : NulsException(io.nuls.core.exception.NulsException) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 29 with NulsException

use of io.nuls.core.exception.NulsException in project nuls by nuls-io.

the class MsgLog method warn.

/**
 * 提供warn级别基本的日志输出
 *
 * @param msg       需要显示的消息
 * @param throwable 异常信息
 */
public static void warn(String msg, Throwable throwable) {
    String logContent = isStringBlank(getId()) ? (getLogTrace() + ":" + msg) : (getLogTrace() + "[" + getId() + "]" + ":" + msg);
    if (!(throwable instanceof NulsException) || !(throwable instanceof NulsRuntimeException)) {
        throwable = new NulsException(ErrorCode.FAILED, throwable);
    }
    LOG.warn(logContent, throwable);
}
Also used : NulsException(io.nuls.core.exception.NulsException) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 30 with NulsException

use of io.nuls.core.exception.NulsException in project nuls by nuls-io.

the class VersionManager method downloadLib.

private static void downloadLib(String folderPath, String file, String sign) throws NulsException {
    byte[] bytes;
    try {
        bytes = HttpDownloadUtils.download(DOWNLOAD_FILE_FOLDER_URL + file);
    } catch (IOException e) {
        throw new NulsException(e);
    }
    // 验证签名
    OutputStream outputStream = null;
    try {
        outputStream = new FileOutputStream(new File(folderPath + "/" + file));
        outputStream.write(bytes);
        outputStream.flush();
    } catch (Exception e) {
        throw new NulsException(e);
    } finally {
        try {
            outputStream.close();
        } catch (IOException e) {
            throw new NulsException(e);
        }
    }
}
Also used : NulsException(io.nuls.core.exception.NulsException) NulsException(io.nuls.core.exception.NulsException)

Aggregations

NulsException (io.nuls.core.exception.NulsException)69 NulsRuntimeException (io.nuls.core.exception.NulsRuntimeException)32 IOException (java.io.IOException)17 ValidateResult (io.nuls.core.validate.ValidateResult)12 Account (io.nuls.account.entity.Account)11 Transaction (io.nuls.core.chain.entity.Transaction)8 BlockRoundData (io.nuls.consensus.entity.block.BlockRoundData)7 Block (io.nuls.core.chain.entity.Block)6 DbSession (io.nuls.db.transactional.annotation.DbSession)6 Coin (io.nuls.ledger.entity.params.Coin)6 CoinTransferData (io.nuls.ledger.entity.params.CoinTransferData)6 Result (io.nuls.core.chain.entity.Result)5 TransactionEvent (io.nuls.ledger.event.TransactionEvent)5 BlockHeader (io.nuls.core.chain.entity.BlockHeader)4 NulsDigestData (io.nuls.core.chain.entity.NulsDigestData)4 Address (io.nuls.account.entity.Address)3 PocMeetingRound (io.nuls.consensus.entity.meeting.PocMeetingRound)3 P2PKHScriptSig (io.nuls.core.script.P2PKHScriptSig)3 NulsByteBuffer (io.nuls.core.utils.io.NulsByteBuffer)3 AccountPo (io.nuls.db.entity.AccountPo)3