/invoke.go Secret
Last active
February 5, 2022 16:40
chaincode panic recover
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) (pb pb.Response) { | |
defer func() (pb pb.Response) { | |
if err := recover(); err != nil { | |
fmt.Println("recover from invoke:", err) | |
debug.PrintStack() | |
// 또는 file로 에러 내용 저장 | |
return shim.Error(fmt.Sprintf("invoke painc. err: %v", err)) | |
} | |
}() | |
function, args := stub.GetFunctionAndParameters() | |
if function == "invoke" { | |
return t.invoke(stub, args) | |
} | |
// ... | |
return shim.Error("Invalid function") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment