Refs #94 - Inject app environment instead of calling directly
Refs #94 - Show error message and add unit test