[CB-2305] Actually throw errors; streamline injected code a bit