void (@NotNull Task task, boolean canceled, @Nullable Throwable error) { try { if (error != null) { task.onThrowable(error); } else if (canceled) { task.onCancel(); } else { task.onSuccess(); } } finally { task.onFinished(); } }