mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-03 11:32:12 +00:00
add error pkg
This commit is contained in:
19
internal/errors/caos_error_test.go
Normal file
19
internal/errors/caos_error_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package errors_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
caos_errs "github.com/caos/utils/errors"
|
||||
)
|
||||
|
||||
func TestErrorMethod(t *testing.T) {
|
||||
err := caos_errs.ThrowError(nil, "id", "msg")
|
||||
expected := "ID=id Message=msg"
|
||||
assert.Equal(t, expected, err.Error())
|
||||
|
||||
err = caos_errs.ThrowError(err, "subID", "subMsg")
|
||||
subExptected := "ID=subID Message=subMsg Parent=(ID=id Message=msg)"
|
||||
assert.Equal(t, subExptected, err.Error())
|
||||
}
|
||||
Reference in New Issue
Block a user