add an environment and return exception details