feat: add typed error message templates and stable replay snapshots
This commit is contained in:
@@ -60,6 +60,9 @@ func MustWithErrors(catalog apierrors.Catalog, next Encoder) Encoder {
|
||||
}
|
||||
func (f *Formatter) ValidateErrors(catalog apierrors.Catalog) error {
|
||||
for key, d := range catalog.Definitions {
|
||||
if _, ok := f.config.Messages[key]; ok && len(d.Params) > 0 {
|
||||
return fmt.Errorf("response: templated error %s must define its message only in the catalog", key)
|
||||
}
|
||||
if err := f.validateError(Result{Code: key, Message: d.Message, BusinessCode: d.Code, Failed: true}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user