Fixes #6375 refs  #5958 Only set 500 headers when a database failure occurs #hacky