svg2png: Add more error message types

Add a message according to the returned Result type.
This commit is contained in:
JunsuChoi 2022-05-06 09:53:00 +09:00 committed by JunsuChoi
parent 0d010bdb6a
commit 8ef075eb27

View file

@ -69,9 +69,16 @@ public:
//Picture //Picture
auto picture = tvg::Picture::gen(); 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; cout << "Error: Couldn't load image " << path << endl;
return 1; 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) { if (w == 0 || h == 0) {