Fix bug related with pagination

There was a bug which avoided to render the errorCode with "details=on". Render methods have been modified and also some unit tests that were broken with the modifications.