mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:52:44 +00:00 
			
		
		
		
	 343e224aa8
			
		
	
	
		343e224aa8
		
	
	
	
	
		
			
			You can now throw exceptions by calling Interpreter::throw_exception(). Anyone who calls ASTNode::execute() needs to check afterwards if the Interpreter now has an exception(), and if so, stop what they're doing and simply return. When catching an exception, we'll first execute the CatchClause node if present. After that, we'll execute the finalizer block if present. This is unlikely to be completely correct, but it's a start! :^)
		
			
				
	
	
		
			10 lines
		
	
	
	
		
			189 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			10 lines
		
	
	
	
		
			189 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| try {
 | |
|     console.log("you should see me");
 | |
|     foo();
 | |
|     console.log("not me");
 | |
| } catch (e) {
 | |
|     console.log("catch");
 | |
|     console.log(e.name);
 | |
| } finally {
 | |
|     console.log("finally");
 | |
| }
 |