public static CStorageException buildCStorageException ( CResponse response , String message , CPath path ) { switch ( response . getStatus ( ) ) { case 401 : return new CAuthenticationException ( message , response ) ; case 404 : message = "No file found at URL " + shortenUrl ( response . getUri ( ) ) + " (" + message + ")" ; return new CFileNotFoundException ( message , path ) ; default : return new CHttpException ( message , response ) ; } }
Some common code between providers . Handles the different status codes and generates a nice exception