1 // Copyright 2011 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.
9 // errorString is a trivial implementation of error.
10 type errorString struct {
15 // New returns an error that formats as the given text.
17 // The returned error contains a Frame set to the caller's location and
18 // implements Formatter to show this information when printed with details.
19 func New(text string) error {
20 return &errorString{text, Caller(1)}
23 func (e *errorString) Error() string {
27 func (e *errorString) Format(s fmt.State, v rune) { FormatError(e, s, v) }
29 func (e *errorString) FormatError(p Printer) (next error) {