Commit 7aaffdad authored by Sietse Ringers's avatar Sietse Ringers
Browse files

feat: irmaclient reports errors to ClientHandlers

parent bd1c54a8
......@@ -66,6 +66,13 @@ func (i *TestClientHandler) ChangePinBlocked(manager irma.SchemeManagerIdentifie
i.t.Fatal(err)
}
}
func (i *TestClientHandler) ReportError(err error) {
select {
case i.c <- err: //nop
default:
i.t.Fatal(err)
}
}
type TestHandler struct {
t *testing.T
......
......@@ -102,6 +102,7 @@ type ClientHandler interface {
UpdateConfiguration(new *irma.IrmaIdentifierSet)
UpdateAttributes()
Revoked(cred *irma.CredentialIdentifier)
ReportError(err error)
}
// MissingAttributes contains all attribute requests that the client cannot satisfy with its
......@@ -218,7 +219,7 @@ func (client *Client) nonrevCredPrepareCache(credid irma.CredentialTypeIdentifie
func (client *Client) reportError(err error) {
irma.Logger.Error(err)
raven.CaptureError(err, nil)
client.handler.ReportError(err)
}
// StartJobs performs scheduled background jobs in separate goroutines.
......
......@@ -403,3 +403,10 @@ func (i *TestClientHandler) ChangePinBlocked(manager irma.SchemeManagerIdentifie
i.t.Fatal(err)
}
}
func (i *TestClientHandler) ReportError(err error) {
select {
case i.c <- err: //nop
default:
i.t.Fatal(err)
}
}
......@@ -9,7 +9,6 @@ import (
"sync"
"time"
"github.com/getsentry/raven-go"
"github.com/go-errors/errors"
"github.com/privacybydesign/gabi/revocation"
irma "github.com/privacybydesign/irmago"
......@@ -195,7 +194,7 @@ func (client *Client) nonrevApplyUpdates(id irma.CredentialTypeIdentifier, count
irma.Logger.WithField("credtype", id).Debug("scheduling nonrevocation cache update")
go func(cred *credential) {
if err := cred.NonrevPrepareCache(); err != nil {
raven.CaptureError(err, nil)
client.reportError(err)
}
}(cred)
}
......
......@@ -10,7 +10,6 @@ import (
"time"
"github.com/bwesterb/go-atum"
raven "github.com/getsentry/raven-go"
"github.com/go-errors/errors"
"github.com/privacybydesign/gabi"
"github.com/privacybydesign/gabi/big"
......@@ -432,7 +431,7 @@ func (session *session) sendResponse(message interface{}) {
log, err = session.createLogEntry(message)
if err != nil {
irma.Logger.Warn(errors.WrapPrefix(err, "Failed to create log entry", 0).ErrorStack())
raven.CaptureError(err, nil)
session.client.reportError(err)
}
case irma.ActionDisclosing:
messageJson, err = json.Marshal(message)
......@@ -454,7 +453,7 @@ func (session *session) sendResponse(message interface{}) {
log, err = session.createLogEntry(message)
if err != nil {
irma.Logger.Warn(errors.WrapPrefix(err, "Failed to create log entry", 0).ErrorStack())
raven.CaptureError(err, nil)
session.client.reportError(err)
}
case irma.ActionIssuing:
response := []*gabi.IssueSignatureMessage{}
......@@ -469,7 +468,7 @@ func (session *session) sendResponse(message interface{}) {
log, err = session.createLogEntry(message)
if err != nil {
irma.Logger.Warn(errors.WrapPrefix(err, "Failed to create log entry", 0).ErrorStack())
raven.CaptureError(err, nil)
session.client.reportError(err)
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment