Advertisement
Badal_hs_shah

Handle Error

Jan 16th, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {Alert, Text, View} from 'react-native';
  2. import APIError from './APIError';
  3. import InvalidVersionAlert from '@src/components/atoms/InvalidVersionAlert';
  4. import ActionSheet from 'react-native-actionsheet';
  5. import {useRef} from 'react';
  6.  
  7. interface ErrorProps {
  8.   error: APIError;
  9.   delegate?: any;
  10. }
  11. const handleError = ({error, delegate}: ErrorProps) => {
  12.   if (error instanceof APIError && error.code === 409) {
  13.     invalidVersionAlert(error, delegate);
  14.   }
  15.  
  16.   function invalidVersionAlert(error: Error, delegate: any) {
  17.     console.log('Badal comes here =====>');
  18.     const message = `Invalid version: ${error.message}`;
  19.   }
  20. };
  21.  
  22. export default handleError;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement