fixed syntax error in Database demo template, modified error handler to throw exception when debug is set to true and exit out