sealing: Errors are hard

This commit is contained in:
Łukasz Magiera 2020-01-23 17:02:55 +01:00
parent 01dc9c767e
commit 08a2e0f82c

View File

@ -46,12 +46,12 @@ func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) err
func (m *Sealing) handleUnsealed(ctx statemachine.Context, sector SectorInfo) error {
if err := checkPieces(ctx.Context(), sector, m.api); err != nil { // Sanity check state
switch err.(type) {
case ErrApi:
case *ErrApi:
log.Errorf("handleUnsealed: api error, not proceeding: %+v", err)
return nil
case ErrInvalidDeals:
case *ErrInvalidDeals:
return ctx.Send(SectorPackingFailed{xerrors.Errorf("invalid deals in sector: %w", err)})
case ErrExpiredDeals: // Probably not much we can do here, maybe re-pack the sector?
case *ErrExpiredDeals: // Probably not much we can do here, maybe re-pack the sector?
return ctx.Send(SectorPackingFailed{xerrors.Errorf("expired deals in sector: %w", err)})
default:
return xerrors.Errorf("checkPieces sanity check error: %w", err)
@ -82,12 +82,12 @@ func (m *Sealing) handleUnsealed(ctx statemachine.Context, sector SectorInfo) er
func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInfo) error {
if err := checkSeal(ctx.Context(), m.maddr, sector, m.api); err != nil {
switch err.(type) {
case ErrApi:
case *ErrApi:
log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err)
return nil
case ErrBadCommD: // TODO: Should this just back to packing? (not really needed since handleUnsealed will do that too)
case *ErrBadCommD: // TODO: Should this just back to packing? (not really needed since handleUnsealed will do that too)
return ctx.Send(SectorSealFailed{xerrors.Errorf("bad CommD error: %w", err)})
case ErrExpiredTicket:
case *ErrExpiredTicket:
return ctx.Send(SectorSealFailed{xerrors.Errorf("bad CommD error: %w", err)})
default:
return xerrors.Errorf("checkSeal sanity check error: %w", err)