Last active
September 7, 2020 10:35
-
-
Save Amokrane/d490978016d0cf7ccaa1e6000f2a7e64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When initializing Criteo | |
try { | |
// initialization code | |
} catch (Exception e) { | |
// all exceptions will be caught (the checked and unchecked) | |
} | |
// when accessing Criteo object | |
@Nullable | |
private Criteo getCriteoSafely() { | |
Criteo criteo = null; | |
try { | |
criteo = Criteo.getInstance(); | |
} catch (IllegalStateException e) { | |
} | |
return criteo; | |
} | |
Criteo criteo = getCriteoSafely(); | |
if (criteo != null) { | |
// do stuff with Criteo | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment