Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package os | 5 package os |
6 | 6 |
7 import syscall "syscall" | 7 import syscall "syscall" |
8 | 8 |
9 // SyscallError records an error from a specific system call. | 9 // SyscallError records an error from a specific system call. |
10 type SyscallError struct { | 10 type SyscallError struct { |
(...skipping 11 matching lines...) Expand all Loading... | |
22 // with the given system call name and error details. | 22 // with the given system call name and error details. |
23 // As a convenience, if err is nil, NewSyscallError returns nil. | 23 // As a convenience, if err is nil, NewSyscallError returns nil. |
24 func NewSyscallError(syscall string, err syscall.Error) Error { | 24 func NewSyscallError(syscall string, err syscall.Error) Error { |
25 if err == nil { | 25 if err == nil { |
26 return nil | 26 return nil |
27 } | 27 } |
28 return &SyscallError{syscall, err.String()} | 28 return &SyscallError{syscall, err.String()} |
29 } | 29 } |
30 | 30 |
31 var ( | 31 var ( |
32 » Eshortstat Error = NewError("stat buffer too small") | 32 » Eshortstat = NewError("stat buffer too small") |
rsc
2011/04/01 21:37:28
s/Error =/=/ throughout
paulzhol
2011/04/01 22:05:43
Done.
| |
33 » Ebadstat Error = NewError("malformed stat buffer") | 33 » Ebadstat = NewError("malformed stat buffer") |
34 » Ebadfd Error = NewError("fd out of range or not open") | 34 » Ebadfd = NewError("fd out of range or not open") |
35 » Ebadarg Error = NewError("bad arg in system call") | 35 » Ebadarg = NewError("bad arg in system call") |
36 » Enotdir Error = NewError("not a directory") | 36 » Enotdir = NewError("not a directory") |
37 » Enonexist Error = NewError("file does not exist") | 37 » Enonexist = NewError("file does not exist") |
38 | 38 |
39 » EINVAL Error = Ebadarg | 39 » EINVAL = Ebadarg |
40 » ENOTDIR Error = Enotdir | 40 » ENOTDIR = Enotdir |
41 » ENOENT Error = Enonexist | 41 » ENOENT = Enonexist |
42 » EPIPE Error = NewError("Broken Pipe") | |
43 | 42 |
44 » ENAMETOOLONG Error = NewError("file name too long") | 43 » ENAMETOOLONG = NewError("file name too long") |
45 » ERANGE Error = NewError("math result not representable") | 44 » ERANGE = NewError("math result not representable") |
46 » EPLAN9 Error = NewError("not supported by plan 9") | 45 » EPIPE = NewError("Broken Pipe") |
46 » EPLAN9 = NewError("not supported by plan 9") | |
47 ) | 47 ) |
48 | 48 |
49 func iserror(err syscall.Error) bool { | 49 func iserror(err syscall.Error) bool { |
50 return err != nil | 50 return err != nil |
51 } | 51 } |
52 | 52 |
53 func Errno(e syscall.Error) syscall.Error { return e } | 53 func Errno(e syscall.Error) syscall.Error { return e } |
LEFT | RIGHT |