mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:22:45 +00:00 
			
		
		
		
	js: Improve usage of TRY when executing a file program
				
					
				
			This commit is contained in:
		
							parent
							
								
									859b810db1
								
							
						
					
					
						commit
						dd25dfbc20
					
				
					 1 changed files with 1 additions and 5 deletions
				
			
		|  | @ -1493,11 +1493,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
| 
 | ||||
|         StringBuilder builder; | ||||
|         for (auto& path : script_paths) { | ||||
|             auto file = Core::File::construct(path); | ||||
|             if (!file->open(Core::OpenMode::ReadOnly)) { | ||||
|                 warnln("Failed to open {}: {}", path, file->error_string()); | ||||
|                 return 1; | ||||
|             } | ||||
|             auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly)); | ||||
|             auto file_contents = file->read_all(); | ||||
|             auto source = StringView { file_contents }; | ||||
|             builder.append(source); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 James Puleo
						James Puleo