mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 18:08:11 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			351 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			351 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| module.exports = fn => async (...args) => {
 | |
|   try {
 | |
|     await fn(...args);
 | |
|   } catch (error) {
 | |
|     if (strapi.errors.isBoom(error)) {
 | |
|       throw error;
 | |
|     }
 | |
| 
 | |
|     // these are errors like unique constraints
 | |
|     strapi.log.error(error);
 | |
|     throw strapi.errors.badRequest('Invalid input data. Please verify unique constraints');
 | |
|   }
 | |
| };
 | 
