about summary refs log tree commit diff
path: root/context
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-03-09T14·17+0100
committerVincent Ambo <github@tazj.in>2018-03-09T14·23+0100
commit3aa2cb8d3efe04eda8cf1d0d2dcb5ad8ddf21147 (patch)
tree45187c7d315d744a820706579222f66626bb0a80 /context
parentb8722ce83bce727d88a61cecff3343d3046e75f7 (diff)
refactor: Remove old error handling library
Removes the old error handling library and switches to plain
fmt.Errorf calls.

There are several reasons for this:

* There are no useful types or handling here anyways, so output format
  is the only priority.
* Users don't care about getting stacktraces.
* My emotional wellbeing.

Fin de siècle.
Diffstat (limited to 'context')
-rw-r--r--context/context.go17
1 files changed, 5 insertions, 12 deletions
diff --git a/context/context.go b/context/context.go
index a6d181e7bc2b..9996f31faa5f 100644
--- a/context/context.go
+++ b/context/context.go
@@ -10,9 +10,9 @@
 package context
 
 import (
+	"fmt"
 	"path"
 
-	"github.com/polydawn/meep"
 	"github.com/tazjin/kontemplate/util"
 )
 
@@ -51,9 +51,8 @@ type Context struct {
 	BaseDir string
 }
 
-type ContextLoadingError struct {
-	meep.AllTraits
-	Filename string
+func contextLoadingError(filename string, cause error) error {
+	return fmt.Errorf("Context loading failed on file %s due to: \n%v", filename, cause)
 }
 
 // Attempt to load and deserialise a Context from the specified file.
@@ -62,10 +61,7 @@ func LoadContextFromFile(filename string) (*Context, error) {
 	err := util.LoadJsonOrYaml(filename, &c)
 
 	if err != nil {
-		return nil, meep.New(
-			&ContextLoadingError{Filename: filename},
-			meep.Cause(err),
-		)
+		return nil, contextLoadingError(filename, err)
 	}
 
 	c.ResourceSets = flattenPrepareResourceSetPaths(&c.ResourceSets)
@@ -74,10 +70,7 @@ func LoadContextFromFile(filename string) (*Context, error) {
 
 	err = c.loadImportedVariables()
 	if err != nil {
-		return nil, meep.New(
-			&ContextLoadingError{Filename: filename},
-			meep.Cause(err),
-		)
+		return nil, contextLoadingError(filename, err)
 	}
 
 	return &c, nil