Corrected error handling for production, development and test environments, w/ stack trace/dump in development.