mirror of https://github.com/infosecn1nja/C3.git
Better error message for missing form properties
parent
3e9ca203c4
commit
22b15fc6e1
|
@ -160,8 +160,6 @@ namespace MWR::C3::Linter
|
|||
FormElement::FormElement(json& definition) :
|
||||
m_Definition(definition)
|
||||
{
|
||||
if (!m_Definition.contains("name"))
|
||||
throw std::invalid_argument{ "Form element must contain 'name' property." };
|
||||
}
|
||||
|
||||
/// Generate FormElement::Type to_json and from_json fuctions to enable serialization
|
||||
|
@ -190,8 +188,10 @@ namespace MWR::C3::Linter
|
|||
{
|
||||
if (!element.is_object())
|
||||
throw std::invalid_argument { "Form element must be a json object." };
|
||||
if (!element.contains("name"))
|
||||
throw std::invalid_argument{ "Form element must contain 'name' property. \nInvalid element:\n" + element.dump(4) };
|
||||
if (!element.contains("type"))
|
||||
throw std::invalid_argument{ "Form element must contain 'type' property." };
|
||||
throw std::invalid_argument{ "Form element '" + element["name"].get<std::string>() + "' must contain 'type' property." };
|
||||
|
||||
switch (element["type"].get<FormElement::Type>())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue