Generic error interface to get status code For #1632#1633
Generic error interface to get status code For #1632#1633snigle wants to merge 1 commit intogophercloud:masterfrom
Conversation
2 similar comments
|
Build succeeded.
|
|
@snigle Thank you for working on this. Are you sure an interface is needed? Since all Also, would you be able to add some unit tests for this PR? Something like the following under a new file called package testing
import (
"testing"
"github.com/gophercloud/gophercloud"
th "github.com/gophercloud/gophercloud/testhelper"
)
func TestGetResponseCode(t *testing.T) {
respErr := gophercloud.ErrUnexpectedResponseCode{
URL: "http://example.com",
Method: "GET",
Expected: []int{200},
Actual: 404,
Body: nil,
}
err404 := gophercloud.ErrDefault404{respErr}
th.AssertEquals(t, err404.GetStatusCode(), 404)
} |
I need the interface because gophercloud return error interface and not ErrDefault404 type. Added the test file thanks. |
|
Build succeeded.
|
Right, but you can cast any error to the common |
|
Superseded by #1820 |
For #1632
Permit to handle gopher error easily of need to just return a status code.
Eg :