github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/go/internal/script/errors.go (about)

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package script
     6  
     7  import (
     8  	"github.com/shogo82148/std/errors"
     9  )
    10  
    11  // ErrUnexpectedSuccess indicates that a script command that was expected to
    12  // fail (as indicated by a "!" prefix) instead completed successfully.
    13  var ErrUnexpectedSuccess = errors.New("unexpected success")
    14  
    15  // A CommandError describes an error resulting from attempting to execute a
    16  // specific command.
    17  type CommandError struct {
    18  	File string
    19  	Line int
    20  	Op   string
    21  	Args []string
    22  	Err  error
    23  }
    24  
    25  func (e *CommandError) Error() string
    26  
    27  func (e *CommandError) Unwrap() error
    28  
    29  // A UsageError reports the valid arguments for a command.
    30  //
    31  // It may be returned in response to invalid arguments.
    32  type UsageError struct {
    33  	Name    string
    34  	Command Cmd
    35  }
    36  
    37  func (e *UsageError) Error() string
    38  
    39  // ErrUsage may be returned by a Command to indicate that it was called with
    40  // invalid arguments; its Usage method may be called to obtain details.
    41  var ErrUsage = errors.New("invalid usage")