diff --git a/tools/analytics/build-analytics b/tools/analytics/build-analytics index 65f755cede..4271c8af29 100755 --- a/tools/analytics/build-analytics +++ b/tools/analytics/build-analytics @@ -1,5 +1,10 @@ #!/usr/bin/env node +// Usage: +// +// build analytics start|success|error| + + 'use strict'; @@ -16,6 +21,11 @@ if (!analytics[actionCategory + 'Start']) { throw new Error('Unknown build-analytics actionCategory "' + actionCategory + '"'); } +var exitCode = Number.parseInt(eventType, 10); +if (!Number.isNaN(exitCode)) { + eventType = (exitCode === 0) ? 'success' : 'error'; +} + if (eventType != 'start' && eventType != 'success' && eventType != 'error') { throw new Error('Unknown build-analytics eventType "' + eventType + '"'); }