mirror of
https://github.com/sam-astro/Z-Sharp.git
synced 2025-12-13 09:02:10 +00:00
Added exception errors
This commit is contained in:
parent
5df1c50c16
commit
ec0e412217
@ -31,12 +31,12 @@ bool AnyAsBool(any val)
|
|||||||
}
|
}
|
||||||
catch (boost::bad_any_cast &e) // Does not convert, return
|
catch (boost::bad_any_cast &e) // Does not convert, return
|
||||||
{
|
{
|
||||||
|
LogWarning("invalid conversion to type \'bool\'")
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will convert type 'any' val to a string
|
// Will convert type 'any' val to a string
|
||||||
@ -68,12 +68,12 @@ string AnyAsString(any val)
|
|||||||
}
|
}
|
||||||
catch (boost::bad_any_cast &e) // Does not convert, return
|
catch (boost::bad_any_cast &e) // Does not convert, return
|
||||||
{
|
{
|
||||||
|
LogWarning("invalid conversion to type \'string\'")
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will convert type 'any' val to a float
|
// Will convert type 'any' val to a float
|
||||||
@ -105,12 +105,12 @@ float AnyAsFloat(any val)
|
|||||||
}
|
}
|
||||||
catch (boost::bad_any_cast &e) // Does not convert, return
|
catch (boost::bad_any_cast &e) // Does not convert, return
|
||||||
{
|
{
|
||||||
|
LogWarning("invalid conversion to type \'float\'")
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will convert type 'any' val to an integer
|
// Will convert type 'any' val to an integer
|
||||||
@ -142,12 +142,12 @@ int AnyAsInt(any val)
|
|||||||
}
|
}
|
||||||
catch (boost::bad_any_cast &e) // Does not convert, return
|
catch (boost::bad_any_cast &e) // Does not convert, return
|
||||||
{
|
{
|
||||||
|
LogWarning("invalid conversion to type \'int\'")
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets type of 'any' val
|
// Gets type of 'any' val
|
||||||
@ -182,12 +182,12 @@ int any_type(any val)
|
|||||||
}
|
}
|
||||||
catch (boost::bad_any_cast &e) // Does not convert, return
|
catch (boost::bad_any_cast &e) // Does not convert, return
|
||||||
{
|
{
|
||||||
|
LogWarning("variable has no type")
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user