-
Notifications
You must be signed in to change notification settings - Fork 77
Introduce new states for XML Validation #2804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
2d82def
to
b3e3841
Compare
b3e3841
to
5e53cf4
Compare
bd28661
to
43d3b75
Compare
$this->failProcessing($filename, 400, "XML validation failed for $filename:" . PHP_EOL . $e->getMessage()); | ||
} | ||
$message = $e->getMessage(); | ||
Log::info($message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use report()
here to include the stack trace in the log while reporting back a nicer error to the user.
Log::info($message); | |
report($e); |
$message = "XML validation failed: Found issues with file $filename:" . PHP_EOL . $error_string; | ||
// We always log validation failures, but we only send messages back to the client if configured to do so | ||
Log::warning("Submission validation failed for file '$filename':" . PHP_EOL); | ||
if ((bool) config('cdash.validate_xml_submissions') === true) { | ||
$this->failProcessing($filename, 400, "XML validation failed: rejected file $filename:" . PHP_EOL . $error_string); | ||
Log::info($message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging this entire message including all of the specific errors could result in very lengthy error messages in the logs. Additionally, I think we should avoid multi-line log messages in general unless there is a good rationale for it. Perhaps just report the "XML validation failed: Found issues with file $filename:"
part in the logs and send the rest back to the user?
bf5439c
to
ffbb826
Compare
Change the name of the environment variable from VALIDATE_XML_SUBMISSIONS to VALIDATE_SUBMISSIONS Change the handling of the XML validation in the environment to be a string setting instead of a boolean. The new state should be as follows No Value or "SILENT": Log a message in the CDash logs and attempt to parse XML "WARN" : Log, return a message with a warning label in the http response of the submission, and attempt to parse XML "REJECT" : Log and return 400 to prevent further submissions and do not attempt to process the XML
ffbb826
to
e6ed50c
Compare
Change the name of the environment variable from VALIDATE_XML_SUBMISSIONS to VALIDATE_SUBMISSIONS
Change the handling of the XML validation in the environment to be a string setting instead of a boolean.
The new state should be as follows
No Value or "SILENT": Log a message in the CDash logs and attempt to parse XML
"WARN" : Log, return a message with a warning label in the
http response of the submission, and attempt to parse XML
"REJECT" : Log and return 400 to prevent further submissions and do not attempt
to process the XML