mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Reword error when file doesn't exist
Applied suggestion from PR Co-authored-by: Vitalii Elenhaupt <3624712+veelenga@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									5f878fb40f
								
							
						
					
					
						commit
						d9b2d69055
					
				
					 2 changed files with 3 additions and 2 deletions
				
			
		|  | @ -85,7 +85,7 @@ module Ameba | |||
|       end | ||||
| 
 | ||||
|       it "raises when custom config file doesn't exist" do | ||||
|         expect_raises(Exception, "Config file is invalid: Unable to find config file foo.yml") do | ||||
|         expect_raises(Exception, "Config file is invalid: Config file does not exist foo.yml") do | ||||
|           Config.load "foo.yml" | ||||
|         end | ||||
|       end | ||||
|  |  | |||
|  | @ -120,7 +120,8 @@ class Ameba::Config | |||
| 
 | ||||
|   protected def self.read_config(path = nil) | ||||
|     if path | ||||
|       return File.exists?(path) ? File.read(path) : raise("Unable to find config file #{path}") | ||||
|       raise ArgumentError.new("Config file does not exist #{path}") unless File.exists?(path) | ||||
|       return File.read(path) | ||||
|     end | ||||
|     each_config_path do |config_path| | ||||
|       return File.read(config_path) if File.exists?(config_path) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue