Throw an exception when instead of calling exit when the "--newlinesoff" argument is used with incompatible targets

This commit is contained in:
Username404 2021-10-07 20:59:46 +02:00
parent aac3085e94
commit 7b1987f81b
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1

View File

@ -128,8 +128,8 @@ shared_ptr<Target> Target::forName(string_view name, const bool newLines = true)
}
#undef ADDTARGET
if (not newLines and not target->supportsOneLine()) {
cout << "--newlinesoff cannot be used with --target=" << name.substr(1) << endl;
exit(0);
name.remove_prefix(1);
throw Yerbacon::Exception(string("--newlinesoff cannot be used with --target=") += name);
}
return target;
};