mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-05-21 00:23:41 +00:00
* Rename `mizu` to `kubeshark` * Rename `up9inc` to `kubeshark` * Change the logo, title, motto and the main color * Replace the favicon * Update the docs link * Change the copyright text in C files * Remove a comment * Rewrite the `README.md` and update the logo and screenshots used in it * Add a `TODO` * Fix the grammar * Fix the bottom text in the filtering guide * Change the Docker Hub username of cross-compilation intermediate images * Add an install script * Fix `docker/login-action` in the CI * Delete `build-custom-branch.yml` GitHub workflow * Update `README.md` * Remove `install.sh` * Change the motto back to "Traffic viewer for Kubernetes"
27 lines
616 B
Go
27 lines
616 B
Go
package goUtils
|
|
|
|
import (
|
|
"reflect"
|
|
"runtime/debug"
|
|
|
|
"github.com/kubeshark/kubeshark/logger"
|
|
)
|
|
|
|
func HandleExcWrapper(fn interface{}, params ...interface{}) (result []reflect.Value) {
|
|
defer func() {
|
|
if panicMessage := recover(); panicMessage != nil {
|
|
stack := debug.Stack()
|
|
logger.Log.Fatalf("Unhandled panic: %v\n stack: %s", panicMessage, stack)
|
|
}
|
|
}()
|
|
f := reflect.ValueOf(fn)
|
|
if f.Type().NumIn() != len(params) {
|
|
panic("incorrect number of parameters!")
|
|
}
|
|
inputs := make([]reflect.Value, len(params))
|
|
for k, in := range params {
|
|
inputs[k] = reflect.ValueOf(in)
|
|
}
|
|
return f.Call(inputs)
|
|
}
|