Skip to content

Commit

Permalink
log warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rushatgabhane committed Aug 2, 2024
1 parent 90ba0ff commit f54c790
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/libs/asyncOpenURL/index.website.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Linking} from 'react-native';
import Log from '@libs/Log';
import type AsyncOpenURL from './types';

/**
Expand All @@ -17,7 +18,9 @@ const asyncOpenURL: AsyncOpenURL = (promise, url, shouldSkipCustomSafariLogic) =
.then((params) => {
Linking.openURL(typeof url === 'string' ? url : url(params));
})
.catch(() => {});
.catch(() => {
Log.warn('[asyncOpenURL] Promise rejected, not opening URL', {url});
});
} else {
const windowRef = window.open();
promise
Expand All @@ -27,7 +30,10 @@ const asyncOpenURL: AsyncOpenURL = (promise, url, shouldSkipCustomSafariLogic) =
}
windowRef.location = typeof url === 'string' ? url : url(params);
})
.catch(() => windowRef?.close());
.catch(() => {
windowRef?.close();
Log.warn('[asyncOpenURL] Promise rejected, not opening URL', {url});
});
}
};

Expand Down

0 comments on commit f54c790

Please sign in to comment.