made error an object

@johnnyman727 r?