@@ -5,6 +5,8 @@ package deployment
55import  (
66	"fmt" 
77
8+ 	"github.com/logicmonitor/k8s-argus/pkg/err" 
9+ 
810	"github.com/logicmonitor/k8s-argus/pkg/constants" 
911	"github.com/logicmonitor/k8s-argus/pkg/types" 
1012	"github.com/logicmonitor/k8s-argus/pkg/utilities" 
@@ -42,6 +44,8 @@ func (w *Watcher) ObjType() runtime.Object {
4244// AddFunc is a function that implements the Watcher interface. 
4345func  (w  * Watcher ) AddFunc () func (obj  interface {}) {
4446	return  func (obj  interface {}) {
47+ 		// Due to panic error in this call stack will crash the application; recovering those panics here could make our application robust. 
48+ 		defer  err .RecoverError ("Add deployment" )
4549		deployment  :=  obj .(* v1beta2.Deployment )
4650
4751		log .Infof ("Handling add deployment event: %s" , deployment .Name )
@@ -53,6 +57,8 @@ func (w *Watcher) AddFunc() func(obj interface{}) {
5357// UpdateFunc is a function that implements the Watcher interface. 
5458func  (w  * Watcher ) UpdateFunc () func (oldObj , newObj  interface {}) {
5559	return  func (oldObj , newObj  interface {}) {
60+ 		// Due to panic error in this call stack will crash the application; recovering those panics here could make our application robust. 
61+ 		defer  err .RecoverError ("Update deployment" )
5662		old  :=  oldObj .(* v1beta2.Deployment )
5763		new  :=  newObj .(* v1beta2.Deployment )
5864
@@ -63,6 +69,8 @@ func (w *Watcher) UpdateFunc() func(oldObj, newObj interface{}) {
6369// DeleteFunc is a function that implements the Watcher interface. 
6470func  (w  * Watcher ) DeleteFunc () func (obj  interface {}) {
6571	return  func (obj  interface {}) {
72+ 		// Due to panic error in this call stack will crash the application; recovering those panics here could make our application robust. 
73+ 		defer  err .RecoverError ("Delete deployment" )
6674		deployment  :=  obj .(* v1beta2.Deployment )
6775
6876		// Delete the deployment. 
0 commit comments