Give more specific error message on browser for nested policies (#4488)

This commit is contained in:
poornas
2017-06-07 19:31:23 -07:00
committed by Harshavardhana
parent 7dcc1e92b4
commit 45a568dd85
2 changed files with 40 additions and 19 deletions

View File

@@ -86,12 +86,19 @@ func TestWriteWebErrorResponse(t *testing.T) {
webErr: InsufficientReadQuorum{},
apiErrCode: ErrReadQuorum,
},
{
webErr: NotImplemented{},
apiErrCode: ErrNotImplemented,
},
}
// Validate all the test cases.
for i, testCase := range testCases {
writeWebErrorResponse(newFlushWriter(&buffer), testCase.webErr)
desc := getAPIError(testCase.apiErrCode).Description
if testCase.apiErrCode == ErrNotImplemented {
desc = "Functionality not implemented"
}
recvDesc := buffer.Bytes()
// Check if the written desc is same as the one expected.
if !bytes.Equal(recvDesc, []byte(desc)) {