add simple plugin to rewrite calls to `error` and `undefined`