Skip to content

Commit 03efe71

Browse files
authored
Fix/panicgrb (#289)
* Better make file * Return the error after panic in LoadKnowledgeBaseFromReader, this to gain insight of what happened that causes panic when loading GRBs
1 parent 167f0b2 commit 03efe71

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ast/KnowledgeBase.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ func (lib *KnowledgeLibrary) LoadKnowledgeBaseFromReader(reader io.Reader, overw
8080
defer func() {
8181
if r := recover(); r != nil {
8282
retKb = nil
83-
logrus.Panicf("panic recovered during LoadKnowledgeBaseFromReader. send us your report to https://github.com/hyperjumptech/grule-rule-engine/issues")
83+
retErr = fmt.Errorf("panic recovered during LoadKnowledgeBaseFromReader, recover \"%v\". send us your report to https://github.com/hyperjumptech/grule-rule-engine/issues", r)
84+
logrus.Panicf("panic recovered during LoadKnowledgeBaseFromReader, recover \"%v\". send us your report to https://github.com/hyperjumptech/grule-rule-engine/issues", r)
8485
}
8586
}()
8687

0 commit comments

Comments
 (0)