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