public void throwException ( ) throws InstagramException { if ( errorMeta != null ) { String msg = errorMeta . getErrorType ( ) + ": " + errorMeta . getErrorMessage ( ) ; switch ( errorMeta . getCode ( ) ) { case 400 : throw new InstagramBadRequestException ( errorMeta . getErrorType ( ) , msg , this . headers ) ; case 429 : throw new InstagramRateLimitException ( errorMeta . getErrorType ( ) , msg , this . headers ) ; default : throw new InstagramException ( errorMeta . getErrorType ( ) , msg , this . headers ) ; } } else { throw new InstagramException ( "No metadata found in response" , this . headers ) ; } }
Throw instagram exception to the client