Skip to content

Commit 0f53030

Browse files
committed
Improve error logging
1 parent d326d15 commit 0f53030

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/libappimage/utils/IconHandleCairoRsvg.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ namespace appimage {
5454
std::move(data.begin(), data.end(), originalData.begin());
5555

5656
// guess the image format by trying to load it
57-
if (!tryLoadPng(originalData) && !tryLoadSvg(originalData)) {
58-
throw IconHandleError("Unable to load image.");
57+
if (!tryLoadPng(originalData)) {
58+
throw IconHandleError("Unable to load PNG image");
59+
}
60+
if (!tryLoadSvg(originalData)) {
61+
throw IconHandleError("Unable to load SVG image");
5962
}
6063

6164
iconSize = iconOriginalSize = getOriginalSize();
@@ -65,8 +68,12 @@ namespace appimage {
6568
readFile(path);
6669

6770
// guess the image format by trying to load it
68-
if (!tryLoadPng(originalData) && !tryLoadSvg(originalData))
69-
throw IconHandleError("Unable to load image.");
71+
if (!tryLoadPng(originalData)) {
72+
throw IconHandleError("Unable to load PNG image");
73+
}
74+
if (!tryLoadSvg(originalData)) {
75+
throw IconHandleError("Unable to load SVG image");
76+
}
7077

7178
iconSize = iconOriginalSize = getOriginalSize();
7279
}

src/libappimage/utils/IconHandleDLOpenCairoRsvg.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ namespace appimage {
88
std::move(data.begin(), data.end(), originalData.begin());
99

1010
// guess the image format by trying to load it
11-
if (!tryLoadPng(originalData) && !tryLoadSvg(originalData)) {
12-
throw IconHandleError("Unable to load image.");
11+
if (!tryLoadPng(originalData)) {
12+
throw IconHandleError("Unable to load PNG image");
13+
}
14+
if (!tryLoadSvg(originalData)) {
15+
throw IconHandleError("Unable to load SVG image");
1316
}
1417

1518
iconSize = iconOriginalSize = getOriginalSize();
@@ -19,8 +22,12 @@ namespace appimage {
1922
readFile(path);
2023

2124
// guess the image format by trying to load it
22-
if (!tryLoadPng(originalData) && !tryLoadSvg(originalData))
23-
throw IconHandleError("Unable to load image.");
25+
if (!tryLoadPng(originalData)) {
26+
throw IconHandleError("Unable to load PNG image");
27+
}
28+
if (!tryLoadSvg(originalData)) {
29+
throw IconHandleError("Unable to load SVG image");
30+
}
2431

2532
iconSize = iconOriginalSize = getOriginalSize();
2633
}

0 commit comments

Comments
 (0)