Skip to content

Commit

Permalink
fix: accept unknown errors
Browse files Browse the repository at this point in the history
  • Loading branch information
joanestebanr committed Nov 25, 2024
1 parent e93e1b2 commit fa13187
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions agglayer/proof_generation_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ type PPError interface {
String() string
}

type GenericError struct {
Key string
Values string
}

func (p *GenericError) String() string {
return fmt.Sprintf("Generic error: %s: %s", p.Key, p.Values)
}

// ProofGenerationError is a struct that represents an error that occurs when generating a proof.
type ProofGenerationError struct {
GenerationType string
Expand Down
4 changes: 3 additions & 1 deletion agglayer/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,9 @@ func (c *CertificateHeader) UnmarshalJSON(data []byte) error {

ppError = p
default:
return fmt.Errorf("invalid error type: %s", key)
valueStr, _ := json.Marshal(value)

ppError = &GenericError{Key: key, Values: string(valueStr)}
}
}

Expand Down

0 comments on commit fa13187

Please sign in to comment.