mirror of
https://github.com/chaisql/chai.git
synced 2025-11-01 03:12:38 +08:00
Refactor to handle errors with internal/errors (#432)
All new error handling code now rely on internal/errors package which provides a compilation time toggle that enables to capture stacktraces for easier debugging while developing. It also comes with a new testutil/assert package which replaces the require package when it comes to checking or comparing errors and printing the stack traces if needed. Finally, the test target of the Makefile uses the debug build tag by default. A testnodebug target is also provided for convenience and to make sure no tests are broken due to not having used the internal/errors or testutil/assert package. See #431 for more details
This commit is contained in:
committed by
GitHub
parent
56025724c3
commit
4a6e68439a
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/genjidb/genji/document"
|
||||
"github.com/genjidb/genji/internal/errors"
|
||||
"github.com/genjidb/genji/internal/expr"
|
||||
"github.com/genjidb/genji/internal/expr/functions"
|
||||
"github.com/genjidb/genji/internal/query"
|
||||
@@ -235,8 +236,8 @@ type ParseError struct {
|
||||
}
|
||||
|
||||
// newParseError returns a new instance of ParseError.
|
||||
func newParseError(found string, expected []string, pos scanner.Pos) *ParseError {
|
||||
return &ParseError{Found: found, Expected: expected, Pos: pos}
|
||||
func newParseError(found string, expected []string, pos scanner.Pos) error {
|
||||
return errors.Wrap(&ParseError{Found: found, Expected: expected, Pos: pos})
|
||||
}
|
||||
|
||||
// Error returns the string representation of the error.
|
||||
|
||||
Reference in New Issue
Block a user