How about something like this? If it's a 4xx error it should still be JSON parseable. If it's 500 we don't know so just show whatever text there might be.