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

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

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


##########
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:
   > 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.
   
   not sure to understand. if the remote cache is disabled. no download will be tried.



-- 
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