More improvements to exceptions by setting script origin and returning an object.