diff options
Diffstat (limited to 'common/herrors/error_locator.go')
-rw-r--r-- | common/herrors/error_locator.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/herrors/error_locator.go b/common/herrors/error_locator.go index 118ab851c..2c0d215b1 100644 --- a/common/herrors/error_locator.go +++ b/common/herrors/error_locator.go @@ -100,6 +100,17 @@ func WithFileContextForFile(e error, realFilename, filename string, fs afero.Fs, return WithFileContext(e, realFilename, f, matcher) } +// WithFileContextForFileDefault tries to add file context using the default line matcher. +func WithFileContextForFileDefault(err error, filename string, fs afero.Fs) error { + err, _ = WithFileContextForFile( + err, + filename, + filename, + fs, + SimpleLineMatcher) + return err +} + // WithFileContextForFile will try to add a file context with lines matching the given matcher. // If no match could be found, the original error is returned with false as the second return value. func WithFileContext(e error, realFilename string, r io.Reader, matcher LineMatcherFn) (error, bool) { |