From 33a64d825b87c842b9ecc243297c7a0248db7180 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Iv=C3=A1n=20M=2EE?= <diegoivan.mae@gmail.com>
Date: Mon, 5 Aug 2024 18:08:36 -0600
Subject: [PATCH] vala: Solve Vala errors at C compile time

---
 src/Document.vala | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Document.vala b/src/Document.vala
index 872309f..e52e1a7 100644
--- a/src/Document.vala
+++ b/src/Document.vala
@@ -451,7 +451,9 @@ public class PaperClip.Document : Object {
                                                    "copies");
 
         int res = DirUtils.create_with_parents (destination_path, 0777);
-        return_if_fail (res > -1);
+        if (res < 0) {
+            throw new IOError.FAILED (@"Could not create $destination_path");
+        }
 
         string destination_file = Path.build_filename (destination_path,
                                                        "%s".printf (original_file.get_basename ()));
