refactor : Refactor error handling to use dry/usefulerror (#283)

* update the go.sum

Signed-off-by: DivyanshuVortex <divyanshuchandra9027@gmail.com>

* migrate most of the files to dry errors

Signed-off-by: DivyanshuVortex <divyanshuchandra9027@gmail.com>

* update the rest of the files

Signed-off-by: DivyanshuVortex <divyanshuchandra9027@gmail.com>

* fixs the review comments

Signed-off-by: DivyanshuVortex <divyanshuchandra9027@gmail.com>

* chores

Signed-off-by: DivyanshuVortex <divyanshuchandra9027@gmail.com>

---------

Signed-off-by: DivyanshuVortex <divyanshuchandra9027@gmail.com>
Co-authored-by: Abhisek Datta <abhisek.datta@gmail.com>
This commit is contained in:
Divyanshu
2026-05-24 12:22:19 +05:30
committed by GitHub
co-authored by Abhisek Datta
parent e5fe0df82e
commit 20e01d5cae
33 changed files with 234 additions and 639 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ import (
"github.com/safedep/pmg/packagemanager"
"github.com/safedep/pmg/sandbox"
"github.com/safedep/pmg/sandbox/executor"
"github.com/safedep/pmg/usefulerror"
"github.com/safedep/dry/usefulerror"
)
type ExecutionMode int
@@ -139,7 +139,7 @@ func runPTY(
beforeWait func(*PTYRuntime) error,
) error {
if !result.ShouldRun() {
return usefulerror.Useful().
return usefulerror.NewUsefulError().
Wrap(fmt.Errorf("sandbox not supported for PTY sessions")).
WithHumanError("Sandbox executed command cannot be used with PTY session. Please use non-interactive TTY mode instead.")
}