useCustomMeasurements.tsx 449 B

123456789101112131415
  1. import {useContext} from 'react';
  2. import {CustomMeasurementsContext} from 'sentry/utils/customMeasurements/customMeasurementsContext';
  3. export default function useCustomMeasurements() {
  4. const customMeasurementsContext = useContext(CustomMeasurementsContext);
  5. if (!customMeasurementsContext) {
  6. throw new Error(
  7. 'useCustomMeasurements was called outside of CustomMeasurementsProvider'
  8. );
  9. }
  10. return customMeasurementsContext;
  11. }