File size: 644 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { captureException } from '@automattic/calypso-sentry';
import { useCallback } from 'react';
import { useIntent } from './use-intent';
import { useSite } from './use-site';

const useCaptureFlowException = ( flowName: string | null, stepName: string ) => {
	const flow = flowName || 'default';
	const intent = useIntent() || null;
	const site = useSite();

	return useCallback(
		( error: any ) => {
			captureException( error, {
				tags: {
					blog_id: site?.ID || null,
					calypso_section: 'setup',
					flow,
					intent,
					stepName,
				},
			} );
		},
		[ flow, intent, site ]
	);
};

export default useCaptureFlowException;