Add error tracing in verbose mode
This issue tracks the addition of https://github.com/juju/errors such that errors can be better understood. Based on the juju errors' README, we need to use the juju errors package to replace the internal package's definition of errors with juju's, i.e.:
index 8206a12..4d88304 100644
--- a/internal/errs/defs.go
+++ b/internal/errs/defs.go
@@ -4,7 +4,9 @@
// You may not use this file expect in compliance with the License.
package errs
-import "errors"
+import
+ "github.com/juju/errors"
+)
However, we actually do NOT need to replace the above, in fact, since internal/errs declares the same (subset) of errors, this can be removed since they will be duplicate. Only when we add new error types (which is possible), would we need to restore this package with custom definitions. Let's hold off for now and simply remove this package.
Instead, to continue this work, I would recommend going through the KraftKit source code and replacing all instances of return fmt.Errorf and errors.New with valid juju errors wrappers. This will allow us to a). classify each error into a category and b). allow us to unwrap each error nicely since the system will homogenise. The moment where errors are actually printed to the console occurs in cmdfactory.Main:
https://github.com/unikraft/kraftkit/blob/06bef518ea77d6ff8d80db3c25bf1064d3e4d7ee/cmdfactory/builder.go#L175-L184
For the first iteration, this needs to be replace with juju errors' Unwrap or Trace method which will output the call stack or the list of errors which have occurred.
Finally, the code related to "user" look up can be removed entirely since this is out-of-scope of the project.
Hello @nderjung If someone isn't working on this issue then I would like to play around it and see if I can solve it, could you please assign me this issue ?
Still want to do this @chococandy63? :sweat_smile:
Hi, I'm a student at the University of Texas at Austin interested in working on this issue as it seems to be available. I'm planning to take on this issue as a part of a project for my virtualization class (CS 360V). Do you have a rough idea of how much effort this would be? @craciunoiuc
Sorry @arvganesh I am already looking into this, but forgot to update it. It's not really a good-first-issue anymore because the project expanded so much since 2022, and the change now requires going through every spot.