"""Retrieve Application details."""
import logging

import gogoutils
import murl
import requests

from ..consts import API_URL

LOG = logging.getLogger(__name__)


def get_details(app='groupproject', env='dev'):
    """Extract details for Application.

    Returns:
        collections.namedtuple with _group_, _policy_, _profile_, _role_,
            _user_.
    """
    api = murl.Url(API_URL)
    api.path = 'applications/{app}'.format(app=app)

    request = requests.get(api.url)
    assert request.ok, 'App does not Exist'

    app_details = request.json()

    LOG.debug('App details: %s', app_details)
    group = app_details['attributes'].get('repoProjectKey')
    project = app_details['attributes'].get('repoSlug')
    generated = gogoutils.Generator(group, project, env=env)

    LOG.debug('Application details: %s', generated)
    return generated

@@ -119,16 +119,62 @@
  API_URL
+%0Afrom ..exceptions import SpinnakerAppNotFound
 %0A%0ALOG = 
@@ -528,17 +528,18 @@
 rl)%0A
+%0A
     
-asser
+if no
 t re
@@ -550,30 +550,76 @@
 t.ok
-, 'App does not Exist'
+:%0A        raise SpinnakerAppNotFound('%22%7B0%7D%22 not found.'.format(app))
 %0A%0A  

Use SpinnakerAppNotFound exception