-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: custom error wrapped around error and commitment meta (#134)
* fix: custom error wrapped around error and commitment meta * refactor: minor improvement for custom errors * fix: lint * refactor: clean up useless handlerError
- Loading branch information
Showing
3 changed files
with
67 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package server | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/Layr-Labs/eigenda-proxy/commitments" | ||
) | ||
|
||
// MetaError includes both an error and commitment metadata | ||
type MetaError struct { | ||
Err error | ||
Meta commitments.CommitmentMeta | ||
} | ||
|
||
func (me MetaError) Error() string { | ||
return fmt.Sprintf("Error: %s (Mode: %s, CertVersion: %b)", | ||
me.Err.Error(), | ||
me.Meta.Mode, | ||
me.Meta.CertVersion) | ||
} | ||
|
||
// NewMetaError creates a new MetaError | ||
func NewMetaError(err error, meta commitments.CommitmentMeta) MetaError { | ||
return MetaError{Err: err, Meta: meta} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters