12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/u3d/failure_reporter.rb', line 12
def report(failure_type: "DEFAULT", failure_message: "", data: {})
return unless ENV['U3D_REPORT_FAILURES']
report = {
type: failure_type,
message: failure_message,
data: data
}
FileUtils.mkdir_p default_report_path
report_file = File.join(
default_report_path,
"#{failure_type}.#{Date.now.strftime('%Y%m%dT%H%M')}.failure.json"
)
File.write(report_file, JSON.pretty_generate(report))
rescue StandardError => e
UI.important "Unable to report a #{failure_type} failure. Please use --verbose to get more information about the failure"
UI.verbose "Unable to report failure: #{e}"
UI.verbose "Failure was: [#{failure_type}]: #{failure_message}"
end
|