You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "alexthomasmc (via GitHub)" <gi...@apache.org> on 2023/04/11 14:31:05 UTC

[GitHub] [maven-build-cache-extension] alexthomasmc commented on a diff in pull request #33: [MBUILDCACHE-32] Do not print exception when probing builds

alexthomasmc commented on code in PR #33:
URL: https://github.com/apache/maven-build-cache-extension/pull/33#discussion_r1162909727


##########
src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryImpl.java:
##########
@@ -165,9 +166,28 @@ public Optional<byte[]> getResourceContent( String url ) throws IOException
             transporter.get( task );
             return Optional.of( task.getDataBytes() );
         }
+        catch ( ResourceDoesNotExistException e )
+        {
+            if ( LOGGER.isDebugEnabled() )
+            {
+                LOGGER.debug( "Cache item not found: {}", getFullUrl( url ), e );
+            }
+            else
+            {
+                LOGGER.info( "Cache item not found: {}", getFullUrl( url ) );
+            }
+            return Optional.empty();
+        }
         catch ( Exception e )
         {
-            LOGGER.info( "Cannot download {}", getFullUrl( url ), e );
+            if ( LOGGER.isDebugEnabled() )
+            {
+                LOGGER.debug( "Cannot download cache item {}", getFullUrl( url ), e );
+            }
+            else
+            {
+                LOGGER.error( "Cannot download cache item {}: {}", getFullUrl( url ), e );
+            }

Review Comment:
   ```suggestion
               LOGGER.error( "Cannot download cache item: {}", getFullUrl( url ), e );
   ```
   Can I suggest that if we get here it should be at least a warning regardless of whether debug is enabled. 
   I'd go for error() as the remote cache can be easily disabled if it is known that it's not available.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org