mirror of
				https://github.com/insomniafi/insomniaid-bot.git
				synced 2025-11-04 01:59:34 +00:00 
			
		
		
		
	Handle CTRL + C with SIGINT event & Add Error handling
This commit is contained in:
		
							
								
								
									
										28
									
								
								src/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/index.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
import { Client as DiscordClient, Collection, IntentsBitField } from "discord.js";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
process.on('SIGINT', () => {
 | 
			
		||||
    process.exit();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
process.on('SIGTERM', () => {
 | 
			
		||||
    process.exit();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
process.on('uncaughtException', (error) => {
 | 
			
		||||
    console.error("Error");
 | 
			
		||||
    console.error(error.name);
 | 
			
		||||
    console.error(error.message);
 | 
			
		||||
    console.error(error.stack);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
process.on('exit', () => {
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
process.on('warning', (warning) => {
 | 
			
		||||
    console.warn("Warning");
 | 
			
		||||
    console.warn(warning.name);
 | 
			
		||||
    console.warn(warning.message);
 | 
			
		||||
    console.warn(warning.stack);
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user