-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding new error response object #240
Conversation
error/errorresponse.go
Outdated
} | ||
|
||
// GetErrorResponse will get the type of err, if the type is a ErrorResponse it will return that as an ErrorResponse, otherwise it will construct a new default ErrorResponse | ||
func GetErrorResponse(err error) ErrorResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not working for me:
var errorResponse ErrorResponse
errorBytes, e := json.Marshal(err)
if e != nil {
return ErrorResponse{Valid: false, Err: err, ErrorType: UnknownError}
}
if e = json.Unmarshal(errorBytes, &errorResponse); err != nil {
return ErrorResponse{Valid: false, Err: err, ErrorType: UnknownError}
}
credential/manifest/model_test.go
Outdated
@@ -98,7 +98,7 @@ func TestCredentialApplication(t *testing.T) { | |||
func TestCredentialResponse(t *testing.T) { | |||
// example here https://identity.foundation/credential-manifest/#credential-response | |||
|
|||
t.Run("Credential Response - Fulfillment Vector 1", func(tt *testing.T) { | |||
t.Run("Credential ErrorResponse - Fulfillment Vector 1", func(tt *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops
error/errorresponse.go
Outdated
|
||
// GetErrorResponse will get the type of err, if the type is a ErrorResponse it will return that as an ErrorResponse, otherwise it will construct a new default ErrorResponse | ||
func GetErrorResponse(err error) ErrorResponse { | ||
errResponseTypeString := reflect.TypeOf(ErrorResponse{}).String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh fun with reflection
Codecov Report
@@ Coverage Diff @@
## main #240 +/- ##
==========================================
+ Coverage 59.09% 59.31% +0.21%
==========================================
Files 36 37 +1
Lines 4190 4234 +44
==========================================
+ Hits 2476 2511 +35
- Misses 1315 1324 +9
Partials 399 399
|
No description provided.