1

Closed

Logging tracing information when OData routing is failed

description

Scenario: when user requests a odata action url with GET http method, which is wrong in in odata spec, the error message returns back from server doesn't show specific error. It shows:
{
"odata.error":{
"code":"","message":{
  "lang":"en-US","value":"No HTTP resource was found that matches the request URI 'http://localhost:1918/odata/Users(1)/GetCorrectAnswerCount'."
},"innererror":{
  "message":"No routing convention was found to select an action for the OData path with template '~/entityset/key/action'.","type":"","stacktrace":""
}
}
}

I expect that it should tell me that GET is not allowed for odata action.

The reason why the error is too generic is because we fallback to next convention if it doesn't match with current convention and we throw when no convention matches. At the time we throw, we lose the specific information about what's wrong.

The possible solution is to have a logger to log errors or warnings in conventions and report it to tracing or client if no convention is found.
Closed Sep 19, 2013 at 11:03 PM by yishaigalatzer
We will look at this again pending customer feedback

comments