feat: complete contract-driven business development and MySQL integration
This commit is contained in:
23
errors/export.go
Normal file
23
errors/export.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package apierrors
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
)
|
||||
|
||||
// ExportCatalog writes normalized, public-only error metadata. Invoke this
|
||||
// explicitly from project tooling, using the same Catalog function registered
|
||||
// at runtime. The API CLI reads the artifact; it never executes project code.
|
||||
func ExportCatalog(w io.Writer, c Catalog) error {
|
||||
if w == nil {
|
||||
return errors.New("errors: catalog export writer required")
|
||||
}
|
||||
registry, err := NewRegistry(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
encoder := json.NewEncoder(w)
|
||||
encoder.SetIndent("", " ")
|
||||
return encoder.Encode(registry.Catalog())
|
||||
}
|
||||
Reference in New Issue
Block a user