1// Copyright 2022 The Gitea Authors. All rights reserved.
2// SPDX-License-Identifier: MIT
3
4package process
5
6import "fmt"
7
8// Error is a wrapped error describing the error results of Process Execution
9type Error struct {
10 PID IDType
11 Description string
12 Err error
13 CtxErr error
14 Stdout string
15 Stderr string
16}
17
18func (err *Error) Error() string {
19 return fmt.Sprintf("exec(%s:%s) failed: %v(%v) stdout: %s stderr: %s", err.PID, err.Description, err.Err, err.CtxErr, err.Stdout, err.Stderr)
20}
21
22// Unwrap implements the unwrappable implicit interface for go1.13 Unwrap()
23func (err *Error) Unwrap() error {
24 return err.Err
25}