mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
export an os.Error constructor
R=r DELTA=20 (6 added, 7 deleted, 7 changed) OCL=15569 CL=15571
This commit is contained in:
parent
66b261a082
commit
0e81bba1fe
2 changed files with 13 additions and 14 deletions
|
|
@ -14,6 +14,12 @@ export type Error struct {
|
|||
|
||||
var ErrorTab = new(map[int64] *Error);
|
||||
|
||||
export func NewError(s string) *Error {
|
||||
e := new(Error);
|
||||
e.s = s
|
||||
return e
|
||||
}
|
||||
|
||||
export func ErrnoToError(errno int64) *Error {
|
||||
if errno == 0 {
|
||||
return nil
|
||||
|
|
@ -22,8 +28,7 @@ export func ErrnoToError(errno int64) *Error {
|
|||
if ok {
|
||||
return err
|
||||
}
|
||||
e := new(Error);
|
||||
e.s = syscall.errstr(errno);
|
||||
e := NewError(syscall.errstr(errno));
|
||||
ErrorTab[errno] = e;
|
||||
return e;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue