github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/process/error.go (about)

     1  // Copyright 2023 The GitBundle Inc. All rights reserved.
     2  // Copyright 2017 The Gitea Authors. All rights reserved.
     3  // Use of this source code is governed by a MIT-style
     4  // license that can be found in the LICENSE file.
     5  
     6  package process
     7  
     8  import "fmt"
     9  
    10  // Error is a wrapped error describing the error results of Process Execution
    11  type Error struct {
    12  	PID         IDType
    13  	Description string
    14  	Err         error
    15  	CtxErr      error
    16  	Stdout      string
    17  	Stderr      string
    18  }
    19  
    20  func (err *Error) Error() string {
    21  	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)
    22  }
    23  
    24  // Unwrap implements the unwrappable implicit interface for go1.13 Unwrap()
    25  func (err *Error) Unwrap() error {
    26  	return err.Err
    27  }