update for error log

This commit is contained in:
CaiHQ 2023-03-15 16:24:05 +08:00
parent bc5dd8a106
commit 487697aa87
2 changed files with 11 additions and 2 deletions

View File

@ -32,6 +32,8 @@ import org.zz.gmhelper.SM2KeyPair;
import org.zz.gmhelper.SM2Util;
import java.io.*;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
@ -878,14 +880,15 @@ public class ContractManager {
initLoadMemory(client);
statusRecorder.createContract(client);
loadProjectConfig(client);
return ret;
default:
return "contract manager can't support:" + c.getType();
}
} catch (Exception e) {
statusRecorder.killContract(c.getID());
r = new ContractResult(Status.Error, new JsonPrimitive("exception occurs: " + e.getMessage()));
ByteArrayOutputStream bo = new ByteArrayOutputStream();
e.printStackTrace(new PrintStream(bo));
r = new ContractResult(Status.Error, new JsonPrimitive(bo.toString()));
return JsonUtil.toJson(r);
}
}

View File

@ -1,10 +1,16 @@
package org.bdware.sc.test;
import org.bdware.sc.ContractManager;
import org.bdware.sc.bean.Contract;
import org.junit.Test;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
public class ContractManagerTest {
public static void main(String[] args) {
ContractManager.yjsPath = "./generatedlib/yjs.jar";
ContractManager.instance = new ContractManager();
}
}