Blame


1 8a7ec697 2015-10-26 adrien package p9pnew
2 8a7ec697 2015-10-26 adrien
3 40d4a02d 2015-11-03 stephen.d import "errors"
4 8a7ec697 2015-10-26 adrien
5 c979b5e1 2015-10-28 stephen.d var (
6 deb98ab4 2015-11-05 stephen.d // 9p wire errors returned by Session interface methods
7 c979b5e1 2015-10-28 stephen.d ErrBadattach = new9pError("unknown specifier in attach")
8 c979b5e1 2015-10-28 stephen.d ErrBadoffset = new9pError("bad offset")
9 c979b5e1 2015-10-28 stephen.d ErrBadcount = new9pError("bad count")
10 c979b5e1 2015-10-28 stephen.d ErrBotch = new9pError("9P protocol botch")
11 c979b5e1 2015-10-28 stephen.d ErrCreatenondir = new9pError("create in non-directory")
12 c979b5e1 2015-10-28 stephen.d ErrDupfid = new9pError("duplicate fid")
13 c979b5e1 2015-10-28 stephen.d ErrDuptag = new9pError("duplicate tag")
14 c979b5e1 2015-10-28 stephen.d ErrIsdir = new9pError("is a directory")
15 c979b5e1 2015-10-28 stephen.d ErrNocreate = new9pError("create prohibited")
16 c979b5e1 2015-10-28 stephen.d ErrNomem = new9pError("out of memory")
17 c979b5e1 2015-10-28 stephen.d ErrNoremove = new9pError("remove prohibited")
18 c979b5e1 2015-10-28 stephen.d ErrNostat = new9pError("stat prohibited")
19 c979b5e1 2015-10-28 stephen.d ErrNotfound = new9pError("file not found")
20 c979b5e1 2015-10-28 stephen.d ErrNowrite = new9pError("write prohibited")
21 c979b5e1 2015-10-28 stephen.d ErrNowstat = new9pError("wstat prohibited")
22 c979b5e1 2015-10-28 stephen.d ErrPerm = new9pError("permission denied")
23 c979b5e1 2015-10-28 stephen.d ErrUnknownfid = new9pError("unknown fid")
24 c979b5e1 2015-10-28 stephen.d ErrBaddir = new9pError("bad directory in wstat")
25 c979b5e1 2015-10-28 stephen.d ErrWalknodir = new9pError("walk in non-directory")
26 c979b5e1 2015-10-28 stephen.d
27 c979b5e1 2015-10-28 stephen.d // extra errors not part of the normal protocol
28 deb98ab4 2015-11-05 stephen.d ErrTimeout = new9pError("fcall timeout") // returned when timing out on the fcall
29 deb98ab4 2015-11-05 stephen.d ErrUnknownTag = new9pError("unknown tag")
30 deb98ab4 2015-11-05 stephen.d ErrUnknownMsg = new9pError("unknown message") // returned when encountering unknown message type
31 deb98ab4 2015-11-05 stephen.d ErrUnexpectedMsg = new9pError("unexpected message") // returned when an unexpected message is encountered
32 deb98ab4 2015-11-05 stephen.d ErrWalkLimit = new9pError("too many wnames in walk")
33 deb98ab4 2015-11-05 stephen.d ErrClosed = errors.New("closed")
34 c979b5e1 2015-10-28 stephen.d )
35 c979b5e1 2015-10-28 stephen.d
36 40d4a02d 2015-11-03 stephen.d // new9pError returns a new 9p error ready for the wire.
37 c979b5e1 2015-10-28 stephen.d func new9pError(s string) error {
38 40d4a02d 2015-11-03 stephen.d return MessageRerror{Ename: s}
39 8a7ec697 2015-10-26 adrien }