<s> import json <EOL> import logging <EOL> from desktop . lib . exceptions import StructuredException <EOL> from desktop . lib . rest . http_client import RestException <EOL> LOG = logging . getLogger ( __name__ ) <EOL> class PermissionDeniedException ( StructuredException ) : <EOL> def __init__ ( self , msg , orig_exc = None ) : <EOL> StructuredException . __init__ ( self , <EOL> "<STR_LIT>" , <EOL> msg ) <EOL> class WebHdfsException ( RestException ) : <EOL> def __init__ ( self , error ) : <EOL> RestException . __init__ ( self , error ) <EOL> self . server_exc = None <EOL> try : <EOL> json_body = json . loads ( self . _message ) <EOL> except ValueError : <EOL> pass <EOL> else : <EOL> remote_exception = json_body . get ( '<STR_LIT>' , { } ) <EOL> exception = remote_exception . get ( '<STR_LIT>' ) <EOL> message = remote_exception . get ( '<STR_LIT:message>' , '<STR_LIT>' ) <EOL> if exception : <EOL> self . server_exc = exception <EOL> self . _message = "<STR_LIT>" % ( self . server_exc , message ) </s>
