Added rule name to exceptions

master
M66B 1 week ago
parent 853fe4c707
commit e552a16e28

@ -3272,7 +3272,7 @@ class Core {
} while (count > 0); } while (count > 0);
} }
private static void onRule(Context context, JSONArray jargs, EntityMessage message) throws JSONException, MessagingException, IOException { private static void onRule(Context context, JSONArray jargs, EntityMessage message) throws Throwable {
// Deferred rule (download headers, body, etc) // Deferred rule (download headers, body, etc)
DB db = DB.getInstance(context); DB db = DB.getInstance(context);

@ -218,25 +218,28 @@ public class EntityRule {
static int run(Context context, List<EntityRule> rules, static int run(Context context, List<EntityRule> rules,
EntityMessage message, boolean browsed, List<Header> headers, String html) EntityMessage message, boolean browsed, List<Header> headers, String html)
throws JSONException, MessagingException, IOException { throws Throwable {
int applied = 0; int applied = 0;
List<String> stopped = new ArrayList<>(); List<String> stopped = new ArrayList<>();
for (EntityRule rule : rules) { for (EntityRule rule : rules)
if (rule.group != null && stopped.contains(rule.group)) try {
continue; if (rule.group != null && stopped.contains(rule.group))
if (rule.matches(context, message, headers, html)) { continue;
if (rule.execute(context, message, browsed, html)) if (rule.matches(context, message, headers, html)) {
applied++; if (rule.execute(context, message, browsed, html))
if (rule.stop) applied++;
if (rule.group == null) if (rule.stop)
break; if (rule.group == null)
else { break;
if (!stopped.contains(rule.group)) else {
stopped.add(rule.group); if (!stopped.contains(rule.group))
} stopped.add(rule.group);
}
}
} catch (Throwable ex) {
throw new Throwable(rule.name, ex);
} }
}
return applied; return applied;
} }

@ -1201,7 +1201,7 @@ public class FragmentFolders extends FragmentBase {
} }
@Override @Override
protected Integer onExecute(Context context, Bundle args) throws JSONException, MessagingException, IOException { protected Integer onExecute(Context context, Bundle args) throws Throwable {
long fid = args.getLong("id"); long fid = args.getLong("id");
DB db = DB.getInstance(context); DB db = DB.getInstance(context);

@ -249,7 +249,7 @@ public class ServiceExternal extends ServiceBase {
ServiceSynchronize.eval(context, "external account=" + accountName + " enabled=" + enabled); ServiceSynchronize.eval(context, "external account=" + accountName + " enabled=" + enabled);
} }
private static void rule(Context context, Intent intent) throws IOException, JSONException, MessagingException { private static void rule(Context context, Intent intent) throws Throwable {
String accountName = intent.getStringExtra("account"); String accountName = intent.getStringExtra("account");
String ruleName = intent.getStringExtra("rule"); String ruleName = intent.getStringExtra("rule");

Loading…
Cancel
Save