code: public static void checkPermission(@NonNull final Context context,
                                         @NonNull final String permission,
                                         @NonNull final String exceptionMessage) {
          if (!hasPermission(context, permission)) {
              throw new SecurityException(exceptionMessage);
          }
      }
docs: Checks if supplied permission is requested in AndroidManifest.xml file.
  <p/>
  Throws {@link SecurityException} if it's not.
  
  @param context          The instance of {@link android.content.Context}.
  @param permission       The checked permission.
  @param exceptionMessage The exception message.