-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy patherrors.go
More file actions
36 lines (28 loc) · 946 Bytes
/
errors.go
File metadata and controls
36 lines (28 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "fmt"
// errUsage indicates a syntax error in a refactoring command. Usage errors are
// independent of the source code being refactored.
type errUsage struct {
err string
}
func newErrUsage(f string, args ...any) *errUsage {
return &errUsage{fmt.Sprintf(f, args...)}
}
func (e *errUsage) Error() string {
return "usage: " + e.err
}
// errPrecondition indicates that a refactoring command was well-formed, but
// some requirement of the command wasn't met by the current Snapshot. For
// example, a referenced identifier wasn't found.
type errPrecondition struct {
err string
}
func newErrPrecondition(f string, args ...any) *errPrecondition {
return &errPrecondition{fmt.Sprintf(f, args...)}
}
func (e *errPrecondition) Error() string {
return e.err
}