Invert throwing error and logging to console.
Fix unit tests. Use setTimeout over the events for tests.
Fix unit tests. Remove unused properties.