From 8ef075eb27c78b595ed76c2169aff1c880603e2b Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Fri, 6 May 2022 09:53:00 +0900 Subject: [PATCH] svg2png: Add more error message types Add a message according to the returned Result type. --- src/bin/svg2png/svg2png.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bin/svg2png/svg2png.cpp b/src/bin/svg2png/svg2png.cpp index 5a2d3448..849ed47e 100644 --- a/src/bin/svg2png/svg2png.cpp +++ b/src/bin/svg2png/svg2png.cpp @@ -69,9 +69,16 @@ public: //Picture auto picture = tvg::Picture::gen(); - if (picture->load(path) != tvg::Result::Success) { + tvg::Result result = picture->load(path); + if (result == tvg::Result::Unknown) { cout << "Error: Couldn't load image " << path << endl; return 1; + } else if (result == tvg::Result::InvalidArguments) { + cout << "Error: Couldn't load image(Invalid path or invalid SVG image) : " << path << endl; + return 1; + } else if (result == tvg::Result::NonSupport) { + cout << "Error: Couldn't load image(Not supported extension) : " << path << endl; + return 1; } if (w == 0 || h == 0) {