Blob


1 package p9pnew
3 import (
4 "errors"
5 "fmt"
6 )
8 // common errors returned by Session interface methods
9 var (
10 ErrClosed = errors.New("closed")
11 )
13 // 9p wire errors returned by Session interface methods
14 var (
15 ErrBadattach = new9pError("unknown specifier in attach")
16 ErrBadoffset = new9pError("bad offset")
17 ErrBadcount = new9pError("bad count")
18 ErrBotch = new9pError("9P protocol botch")
19 ErrCreatenondir = new9pError("create in non-directory")
20 ErrDupfid = new9pError("duplicate fid")
21 ErrDuptag = new9pError("duplicate tag")
22 ErrIsdir = new9pError("is a directory")
23 ErrNocreate = new9pError("create prohibited")
24 ErrNomem = new9pError("out of memory")
25 ErrNoremove = new9pError("remove prohibited")
26 ErrNostat = new9pError("stat prohibited")
27 ErrNotfound = new9pError("file not found")
28 ErrNowrite = new9pError("write prohibited")
29 ErrNowstat = new9pError("wstat prohibited")
30 ErrPerm = new9pError("permission denied")
31 ErrUnknownfid = new9pError("unknown fid")
32 ErrBaddir = new9pError("bad directory in wstat")
33 ErrWalknodir = new9pError("walk in non-directory")
35 // extra errors not part of the normal protocol
36 ErrTimeout = new9pError("fcall timeout") // returned when timing out on the fcall
37 )
39 type error9p struct {
40 Name string
41 }
43 func new9pError(s string) error {
44 return error9p{Name: s}
45 }
47 func (e error9p) Error() string {
48 return fmt.Sprintf("9p: %v", e.Name)
49 }