mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 18:27:58 -06:00
2nd attempt to fix non compatible (newer) .3mf and .amf import error handling on Linux and OsX
This commit is contained in:
parent
813a73e614
commit
0b03f0eb66
1 changed files with 14 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
||||||
#include "3mf.hpp"
|
#include "3mf.hpp"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
|
@ -102,6 +103,13 @@ const char* INVALID_OBJECT_TYPES[] =
|
||||||
"other"
|
"other"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class version_error : public std::runtime_error
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
version_error(const std::string& what_arg) : std::runtime_error(what_arg) {}
|
||||||
|
version_error(const char* what_arg) : std::runtime_error(what_arg) {}
|
||||||
|
};
|
||||||
|
|
||||||
const char* get_attribute_value_charptr(const char** attributes, unsigned int attributes_size, const char* attribute_key)
|
const char* get_attribute_value_charptr(const char** attributes, unsigned int attributes_size, const char* attribute_key)
|
||||||
{
|
{
|
||||||
if ((attributes == nullptr) || (attributes_size == 0) || (attributes_size % 2 != 0) || (attribute_key == nullptr))
|
if ((attributes == nullptr) || (attributes_size == 0) || (attributes_size % 2 != 0) || (attribute_key == nullptr))
|
||||||
|
@ -731,6 +739,11 @@ namespace Slic3r {
|
||||||
return n;
|
return n;
|
||||||
}, &data, 0);
|
}, &data, 0);
|
||||||
}
|
}
|
||||||
|
catch (const version_error& e)
|
||||||
|
{
|
||||||
|
// rethrow the exception
|
||||||
|
throw std::runtime_error(e.what());
|
||||||
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
add_error(e.what());
|
add_error(e.what());
|
||||||
|
@ -1440,7 +1453,7 @@ namespace Slic3r {
|
||||||
if (m_check_version && (m_version > VERSION_3MF))
|
if (m_check_version && (m_version > VERSION_3MF))
|
||||||
{
|
{
|
||||||
std::string msg = _(L("The selected 3mf file has been saved with a newer version of " + std::string(SLIC3R_APP_NAME) + " and is not compatibile."));
|
std::string msg = _(L("The selected 3mf file has been saved with a newer version of " + std::string(SLIC3R_APP_NAME) + " and is not compatibile."));
|
||||||
throw std::runtime_error(msg.c_str());
|
throw version_error(msg.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue