playground.js: display vet errors when program has no output
When program has no output and vet errors are encountered, initialize data.Events as an empty array. Fixes golang/go#25455. Change-Id: Icedd77685b784505da3bb6383629cdfa8b8b22e9 Reviewed-on: https://go-review.googlesource.com/113875 Run-TryBot: Yury Smolsky <yury@smolsky.by> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
This commit is contained in:
parent
1937f90a1b
commit
a5b4c53f6e
|
@ -109,7 +109,10 @@ function HTTPTransport(enableVet) {
|
|||
dataType: "json",
|
||||
success: function(dataVet) {
|
||||
if (dataVet.Errors) {
|
||||
// inject errors from the vet as the first event in the output
|
||||
if (!data.Events) {
|
||||
data.Events = [];
|
||||
}
|
||||
// inject errors from the vet as the first events in the output
|
||||
data.Events.unshift({Message: 'Go vet exited.\n\n', Kind: 'system', Delay: 0});
|
||||
data.Events.unshift({Message: dataVet.Errors, Kind: 'stderr', Delay: 0});
|
||||
}
|
||||
|
|
|
@ -2398,7 +2398,10 @@ function HTTPTransport(enableVet) {
|
|||
dataType: "json",
|
||||
success: function(dataVet) {
|
||||
if (dataVet.Errors) {
|
||||
// inject errors from the vet as the first event in the output
|
||||
if (!data.Events) {
|
||||
data.Events = [];
|
||||
}
|
||||
// inject errors from the vet as the first events in the output
|
||||
data.Events.unshift({Message: 'Go vet exited.\n\n', Kind: 'system', Delay: 0});
|
||||
data.Events.unshift({Message: dataVet.Errors, Kind: 'stderr', Delay: 0});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue