# -*- coding: utf-8 -*-
from __future__ import (absolute_import, print_function, unicode_literals)
from acli.output.account import output_account_info
from acli.connections import get_boto3_session


def account_info(aws_config):
    """
    @type aws_config: Config
    """
    session = get_boto3_session(aws_config)
    iam_client = session.client('iam')
    aliases = iam_client.list_account_aliases().get('AccountAliases')
    account_id = iam_client.get_user().get('User').get('Arn').split(':')[4]
    output_account_info(output_media='console',
                        account_id=account_id,
                        account_aliases=aliases)

@@ -191,16 +191,67 @@
 session%0A
+from botocore.exceptions import NoCredentialsError%0A
 %0A%0Adef ac
@@ -402,16 +402,29 @@
 ('iam')%0A
+    try:%0A    
     alia
@@ -485,16 +485,20 @@
 iases')%0A
+    
     acco
@@ -569,16 +569,20 @@
 %5B4%5D%0A    
+ 
+   
 output_a
@@ -633,32 +633,36 @@
                 
+  
+  
 account_id=accou
@@ -668,16 +668,20 @@
 unt_id,%0A
+    
         
@@ -721,8 +721,160 @@
 liases)%0A
+    except NoCredentialsError:%0A        exit('No credentials were found.')%0A    except Exception as e:%0A        exit('Unhandled exception: %7B0%7D'.format(e))%0A

add credentials check for accounts.