diff --git a/src/main/java/org/bdware/sc/ContractManager.java b/src/main/java/org/bdware/sc/ContractManager.java index 40dc459..3d6f51e 100644 --- a/src/main/java/org/bdware/sc/ContractManager.java +++ b/src/main/java/org/bdware/sc/ContractManager.java @@ -799,6 +799,11 @@ public class ContractManager { try { if (c.getScriptStr().startsWith("/")) { c.startInfo.isYPK = true; + File ypkFile = new File(c.getScriptStr()); + if (!ypkFile.exists()) { + r = new ContractResult(Status.Error, new JsonPrimitive("no such ypk file")); + return JsonUtil.toJson(r); + } String[] str = c.getScriptStr().split("/"); String tmp = new File(dir + "/publicCompiled/ypkName").getAbsolutePath(); String[] str2 = tmp.split("/"); @@ -924,7 +929,7 @@ public class ContractManager { } } catch (Exception e) { e.printStackTrace(); - r = new ContractResult(Status.Error, new JsonPrimitive("exception occurs")); + r = new ContractResult(Status.Error, new JsonPrimitive("exception occurs: " + e.getMessage())); return JsonUtil.toJson(r); } } diff --git a/src/main/java/org/bdware/sc/MultiContractRecorder.java b/src/main/java/org/bdware/sc/MultiContractRecorder.java index 601dbac..4cb3c27 100644 --- a/src/main/java/org/bdware/sc/MultiContractRecorder.java +++ b/src/main/java/org/bdware/sc/MultiContractRecorder.java @@ -23,7 +23,7 @@ public class MultiContractRecorder extends StatusRecorder { CMTables.LastExeSeq.toString(), meta.getContractID())); meta.setLastExeSeq(lastExeSeq); } catch (Exception e) { - e.printStackTrace(); + LOGGER.error(e); } } }