[tracker-miners/wip/carlosg/extractor-additional-files: 2/2] tracker-extract: Produce clearer error if fed a file that cannot be extracted




commit 334bbd2520e69b9f7c1290012cf3291c2a9016fa
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Oct 30 15:23:44 2021 +0200

    tracker-extract: Produce clearer error if fed a file that cannot be extracted
    
    In the case we are mistakenly fed a file that is not covered by any extractor
    rules, produce a more specific error. It may avoid some further head
    scratching in the future.

 src/tracker-extract/tracker-extract.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index c44a76a2f..76ed041f1 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -565,6 +565,17 @@ dispatch_task_cb (TrackerExtractTask *task)
 
        priv = TRACKER_EXTRACT_GET_PRIVATE (task->extract);
 
+       task->graph = tracker_extract_module_manager_get_graph (task->mimetype);
+       if (!task->graph) {
+               g_task_return_new_error (G_TASK (task->res),
+                                        tracker_extract_error_quark (),
+                                        TRACKER_EXTRACT_ERROR_NO_EXTRACTOR,
+                                        "Unknown target graph for uri:'%s' and mime:'%s'",
+                                        task->file, task->mimetype);
+               extract_task_free (task);
+               return FALSE;
+       }
+
        if (!task->mimetype) {
                g_task_return_new_error (G_TASK (task->res),
                                         tracker_extract_error_quark (),
@@ -578,8 +589,6 @@ dispatch_task_cb (TrackerExtractTask *task)
                                                                          &task->func);
        }
 
-       task->graph = tracker_extract_module_manager_get_graph (task->mimetype);
-
        async_queue = g_hash_table_lookup (priv->single_thread_extractors,
                                           task->module);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]