Skip to content

Commit

Permalink
Merge pull request #23 from tandasat/main
Browse files Browse the repository at this point in the history
added user friendly error message
  • Loading branch information
pathtofile authored Nov 15, 2022
2 parents 77932ff + 75ad302 commit 654306d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
20 changes: 16 additions & 4 deletions sealighter/sealighter_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void add_filter_to_vector_property_compare


/*
Add a single "property is" filter to a list.
Add a single "property is" filter to a list.
*/
void add_filter_to_vector_property_is_item
(
Expand Down Expand Up @@ -393,7 +393,7 @@ int add_filters_to_vector
log_messageA("failed to add filters from config to provider\n");
log_messageA("%s\n", e.what());
status = SEALIGHTER_ERROR_PARSE_FILTER;
}
}
return status;
}

Expand All @@ -412,7 +412,7 @@ int add_filters
int status = ERROR_SUCCESS;

if (json_provider["filters"].is_null() ||
(json_provider["filters"]["any_of"].is_null() &&
(json_provider["filters"]["any_of"].is_null() &&
json_provider["filters"]["all_of"].is_null() &&
json_provider["filters"]["none_of"].is_null()
)
Expand Down Expand Up @@ -664,7 +664,14 @@ int add_user_traces
pNew_provider = new provider<>(provider_guid);
}
else {
pNew_provider = new provider<>(provider_name);
try {
pNew_provider = new provider<>(provider_name);
}
catch (const std::exception & e) {
log_messageA("%s\n", e.what());
status = SEALIGHTER_ERROR_NO_PROVIDER;
break;
}
}
log_messageW(L"User Provider: %s\n", provider_name.c_str());
log_messageA(" Trace Name: %s\n", trace_name.c_str());
Expand Down Expand Up @@ -883,6 +890,11 @@ void run_trace(trace<T>* trace)
try {
trace->start();
}
catch (const std::exception & e) {
log_messageA("%s\n", e.what());
trace->stop();
throw;
}
catch (...) {
trace->stop();
throw;
Expand Down
3 changes: 3 additions & 0 deletions sealighter/sealighter_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@

// Counld't open output stream to output file
#define SEALIGHTER_ERROR_OUTPUT_FILE 13

// Failed to resolve the specified provider
#define SEALIGHTER_ERROR_NO_PROVIDER 14

0 comments on commit 654306d

Please sign in to comment.