mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:32:45 +00:00 
			
		
		
		
	LibJS: Add generic InvalidLength error type
We have multiple array types now, so ArrayInvalidLength has been replaced with a generic InvalidLength. Also fixes a small issue in the Array constructor, it should throw RangeError for invalid lengths, not TypeError.
This commit is contained in:
		
							parent
							
								
									5e08ae4e14
								
							
						
					
					
						commit
						6de4f1fcb3
					
				
					 4 changed files with 4 additions and 4 deletions
				
			
		|  | @ -67,7 +67,7 @@ Value ArrayConstructor::call() | |||
|     if (vm().argument_count() == 1 && vm().argument(0).is_number()) { | ||||
|         auto array_length_value = vm().argument(0); | ||||
|         if (!array_length_value.is_integer() || array_length_value.as_i32() < 0) { | ||||
|             vm().throw_exception<TypeError>(global_object(), ErrorType::ArrayInvalidLength); | ||||
|             vm().throw_exception<RangeError>(global_object(), ErrorType::InvalidLength, "array"); | ||||
|             return {}; | ||||
|         } | ||||
|         auto* array = Array::create(global_object()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Linus Groh
						Linus Groh