added error event hooks

This commit is contained in:
Gani Georgiev committed 2022-12-02 16:36:15 +02:00
1 parent 23fbfab63a
commit 02f72638b8
7 files changed
+70 -9

No files matched your search

+10
View File
@@ -87,6 +87,16 @@ func NewTestApp(optTestDataDir ...string) (*TestApp, error) {
TestMailer: &TestMailer{},
}
t.OnBeforeApiError().Add(func(e *core.ApiErrorEvent) error {
t.EventCalls["OnBeforeApiError"]++
return nil
})
t.OnAfterApiError().Add(func(e *core.ApiErrorEvent) error {
t.EventCalls["OnAfterApiError"]++
return nil
})
t.OnModelBeforeCreate().Add(func(e *core.ModelEvent) error {
t.EventCalls["OnModelBeforeCreate"]++
return nil