Allow entity to be retrieve from EntityInvalid error

I'd like to be able to get the entity back from an EntityInvalid error, so that I can send the errors as json. I added this attr reader, but I'm not exactly sure where to test this.