Rename package "errs" to "errors"

Signed-off-by: Jingwen Peng <pengsrc@yunify.com>
This commit is contained in:
Jingwen Peng 2017-01-05 21:11:13 +08:00 committed by Aspire
parent 03abd16068
commit 03e5a0572a
4 changed files with 10 additions and 8 deletions

View File

@ -14,7 +14,7 @@
// | limitations under the License.
// +-------------------------------------------------------------------------
package errs
package errors
import (
"fmt"

View File

@ -14,9 +14,11 @@
// | limitations under the License.
// +-------------------------------------------------------------------------
package errs
package errors
import "fmt"
import (
"fmt"
)
// QingCloudError stores information of a QingCloud error response.
type QingCloudError struct {

View File

@ -27,7 +27,7 @@ import (
"github.com/yunify/qingcloud-sdk-go/logger"
"github.com/yunify/qingcloud-sdk-go/request/data"
"github.com/yunify/qingcloud-sdk-go/request/errs"
"github.com/yunify/qingcloud-sdk-go/request/errors"
"github.com/yunify/qingcloud-sdk-go/utils"
)
@ -126,7 +126,7 @@ func (u *Unpacker) parseError() error {
messageValue.IsValid() && messageValue.Type().String() == "string" &&
retCodeValue.Int() != 0 {
return &errs.QingCloudError{
return &errors.QingCloudError{
RetCode: int(retCodeValue.Int()),
Message: messageValue.String(),
}

View File

@ -27,7 +27,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/yunify/qingcloud-sdk-go/request/data"
"github.com/yunify/qingcloud-sdk-go/request/errs"
"github.com/yunify/qingcloud-sdk-go/request/errors"
)
func TestUnpackerUnpackHTTPRequest(t *testing.T) {
@ -52,7 +52,7 @@ func TestUnpackerUnpackHTTPRequest(t *testing.T) {
type DescribeVolumesOutput struct {
StatusCode int `location:"statusCode"`
Error *errs.QingCloudError
Error *errors.QingCloudError
Action string `json:"action" name:"action"`
RetCode int `json:"ret_code" name:"ret_code"`
@ -123,7 +123,7 @@ func TestUnpacker_UnpackHTTPRequestWithError(t *testing.T) {
err := unpacker.UnpackHTTPRequest(&data.Operation{}, httpResponse, &outputValue)
assert.NotNil(t, err)
switch e := err.(type) {
case errs.QingCloudError:
case errors.QingCloudError:
assert.Equal(t, e.RetCode, 1400)
}
}