diff --git a/agglayer/proof_generation_error.go b/agglayer/proof_generation_error.go index fa7012f74..50858c2e5 100644 --- a/agglayer/proof_generation_error.go +++ b/agglayer/proof_generation_error.go @@ -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 diff --git a/agglayer/types.go b/agglayer/types.go index 9a56d8786..dbeeed4a6 100644 --- a/agglayer/types.go +++ b/agglayer/types.go @@ -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)} } }