Skip to content

Commit

Permalink
debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdietrich committed Oct 22, 2024
1 parent 603d864 commit 7023354
Show file tree
Hide file tree
Showing 4 changed files with 434 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/config/parser/json_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ package parser
import (
"encoding/json"
"github.com/jmartin82/mmock/v3/pkg/mock"
"github.com/jmartin82/mmock/v3/internal/config/logger"
"path/filepath"
"strings"
)

var log = logger.Log

// JSONReader struct created to read json config files
type JSONReader struct {
}
Expand All @@ -20,8 +23,12 @@ func (jp JSONReader) CanParse(filename string) bool {
func (jp JSONReader) Parse(buf []byte) (mock.Definition, error) {
m := mock.Definition{}
err := json.Unmarshal(buf, &m)

if err != nil {
return mock.Definition{}, err
log.Errorf("JSONReader Parse error: %v", err)
log.Errorf("JSONReader attempted to parse: %v", string(buf))
return mock.Definition{}, err
}

return m, nil
}
Loading

0 comments on commit 7023354

Please sign in to comment.