mirror of
				https://github.com/n8n-io/n8n-nodes-starter.git
				synced 2025-10-30 23:02:25 -05:00 
			
		
		
		
	
		
			
	
	
		
			18 lines
		
	
	
	
		
			533 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			18 lines
		
	
	
	
		
			533 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
|  | import type { | ||
|  | 	IExecuteSingleFunctions, | ||
|  | 	IN8nHttpFullResponse, | ||
|  | 	INodeExecutionData, | ||
|  | 	JsonObject, | ||
|  | } from 'n8n-workflow'; | ||
|  | import { NodeApiError } from 'n8n-workflow'; | ||
|  | 
 | ||
|  | export async function sendErrorPostReceive( | ||
|  | 	this: IExecuteSingleFunctions, | ||
|  | 	data: INodeExecutionData[], | ||
|  | 	response: IN8nHttpFullResponse, | ||
|  | ): Promise<INodeExecutionData[]> { | ||
|  | 	if (String(response.statusCode).startsWith('4') || String(response.statusCode).startsWith('5')) { | ||
|  | 		throw new NodeApiError(this.getNode(), response as unknown as JsonObject); | ||
|  | 	} | ||
|  | 	return data; | ||
|  | } |