feat: capture logged exceptions and integrate storage-server with sentry

This commit is contained in:
2023-10-19 21:47:09 +02:00
parent efb8ba8b99
commit 1544212ab5
32 changed files with 172 additions and 113 deletions

View File

@ -148,7 +148,7 @@ func SearchDevices(ctx context.Context) (chan Device, error) {
defer searchDevicesMutex.Unlock()
if err := service.Run(ctx, serviceDiscoveryPollingInterval); err != nil && !errors.Is(err, context.DeadlineExceeded) {
logger.Error(ctx, "error while running cast service discovery", logger.E(errors.WithStack(err)))
logger.Error(ctx, "error while running cast service discovery", logger.CapturedE(errors.WithStack(err)))
}
}()

View File

@ -71,7 +71,7 @@ func (d *Service) Run(ctx context.Context, interval time.Duration) error {
logger.Error(
ctx, "could not poll interface",
logger.E(errors.WithStack(err)), logger.F("iface", iface.Name),
logger.CapturedE(errors.WithStack(err)), logger.F("iface", iface.Name),
)
}
}(pollCtx, iface)

View File

@ -60,7 +60,7 @@ func (m *Module) refreshDevices(call goja.FunctionCall, rt *goja.Runtime) goja.V
devices, err := ListDevices(ctx, true)
if err != nil {
err = errors.WithStack(err)
logger.Error(ctx, "error refreshing casting devices list", logger.E(errors.WithStack(err)))
logger.Error(ctx, "error refreshing casting devices list", logger.CapturedE(errors.WithStack(err)))
promise.Reject(err)
@ -108,7 +108,7 @@ func (m *Module) loadUrl(call goja.FunctionCall, rt *goja.Runtime) goja.Value {
err := LoadURL(ctx, deviceUUID, url)
if err != nil {
err = errors.WithStack(err)
logger.Error(ctx, "error while casting url", logger.E(err))
logger.Error(ctx, "error while casting url", logger.CapturedE(err))
promise.Reject(err)
@ -143,7 +143,7 @@ func (m *Module) stopCast(call goja.FunctionCall, rt *goja.Runtime) goja.Value {
err := StopCast(ctx, deviceUUID)
if err != nil {
err = errors.WithStack(err)
logger.Error(ctx, "error while quitting casting device app", logger.E(errors.WithStack(err)))
logger.Error(ctx, "error while quitting casting device app", logger.CapturedE(errors.WithStack(err)))
promise.Reject(err)
@ -178,7 +178,7 @@ func (m *Module) getStatus(call goja.FunctionCall, rt *goja.Runtime) goja.Value
status, err := getStatus(ctx, deviceUUID)
if err != nil {
err = errors.WithStack(err)
logger.Error(ctx, "error while getting casting device status", logger.E(err))
logger.Error(ctx, "error while getting casting device status", logger.CapturedE(err))
promise.Reject(err)