OctoFetcher: extract method fail_with_message (#569)
This commit is contained in:
		
							parent
							
								
									74fdc2026a
								
							
						
					
					
						commit
						630b8cee88
					
				@ -311,14 +311,17 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
 | 
				
			|||||||
        yield
 | 
					        yield
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    rescue MovedPermanentlyError => e
 | 
					    rescue MovedPermanentlyError => e
 | 
				
			||||||
      Helper.log.error("#{e.class}: #{e.message}")
 | 
					      fail_with_message(e, "The repository has moved, update your configuration")
 | 
				
			||||||
      sys_abort("The repository has moved, please update your configuration")
 | 
					 | 
				
			||||||
    rescue Octokit::Forbidden => e
 | 
					    rescue Octokit::Forbidden => e
 | 
				
			||||||
      Helper.log.error("#{e.class}: #{e.message}")
 | 
					      fail_with_message(e, "Exceeded retry limit")
 | 
				
			||||||
      sys_abort("Exceeded retry limit")
 | 
					 | 
				
			||||||
    rescue Octokit::Unauthorized => e
 | 
					    rescue Octokit::Unauthorized => e
 | 
				
			||||||
 | 
					      fail_with_message(e, "Error: wrong GitHub token")
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Presents the exception, and the aborts with the message.
 | 
				
			||||||
 | 
					    def fail_with_message(e, message)
 | 
				
			||||||
      Helper.log.error("#{e.class}: #{e.message}")
 | 
					      Helper.log.error("#{e.class}: #{e.message}")
 | 
				
			||||||
      sys_abort("Error: wrong GitHub token")
 | 
					      sys_abort(message)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Exponential backoff
 | 
					    # Exponential backoff
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user