Change constructor to prototype in Object.error()