Refactor domain error to use errorId (#790)

* Refactor domain error to use errorId

* Wrap accepts options and uses New internally
This commit is contained in:
Louis Ruch authored and GitHub committed 2020-11-17 18:54:23 -08:00
1 parent b8a5b9adf1
commit d30dd0ff64
8 files changed
+184 -103

No files matched your search

+11 -5
View File
@@ -44,7 +44,9 @@ func TestError_IsUnique(t *testing.T) {
},
{
name: "wrapped-pq-is-unique",
in: errors.New(errors.NotUnique,
in: errors.New(
errors.NotUnique,
"",
errors.WithWrap(&pq.Error{
Code: pq.ErrorCode("23505"),
}),
@@ -96,12 +98,14 @@ func TestError_IsCheckConstraint(t *testing.T) {
},
{
name: "ErrCodeCheckConstraint",
in: errors.New(errors.CheckConstraint),
in: errors.New(errors.CheckConstraint, ""),
want: true,
},
{
name: "wrapped-pq-is-check-constraint",
in: errors.New(errors.CheckConstraint,
in: errors.New(
errors.CheckConstraint,
"",
errors.WithWrap(&pq.Error{
Code: pq.ErrorCode("23514"),
}),
@@ -160,12 +164,14 @@ func TestError_IsNotNullError(t *testing.T) {
},
{
name: "ErrCodeNotNull",
in: errors.New(errors.NotNull),
in: errors.New(errors.NotNull, ""),
want: true,
},
{
name: "wrapped-pq-is-not-null",
in: errors.New(errors.NotNull,
in: errors.New(
errors.NotNull,
"",
errors.WithWrap(&pq.Error{
Code: pq.ErrorCode("23502"),
}),