github.com/cyverse/go-irodsclient@v0.13.2/irods/message/close_data_object_response.go (about) 1 package message 2 3 import ( 4 "github.com/cyverse/go-irodsclient/irods/common" 5 "github.com/cyverse/go-irodsclient/irods/types" 6 "golang.org/x/xerrors" 7 ) 8 9 // IRODSMessageCloseDataObjectResponse stores data object close response 10 type IRODSMessageCloseDataObjectResponse struct { 11 // empty structure 12 Result int 13 } 14 15 // CheckError returns error if server returned an error 16 func (msg *IRODSMessageCloseDataObjectResponse) CheckError() error { 17 if msg.Result < 0 { 18 return types.NewIRODSError(common.ErrorCode(msg.Result)) 19 } 20 return nil 21 } 22 23 // FromMessage returns struct from IRODSMessage 24 func (msg *IRODSMessageCloseDataObjectResponse) FromMessage(msgIn *IRODSMessage) error { 25 if msgIn.Body == nil { 26 return xerrors.Errorf("empty message body") 27 } 28 29 msg.Result = int(msgIn.Body.IntInfo) 30 return nil 31 }