mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-19 22:19:29 +02:00
book.js: early return if response error (#2520)
It used to have a ugly error message shows that "Playground Communication: Cannot read properties of undefined (reading 'trim')", which is due to the fact that the response lacks stdout attr. Issue: #2477 Signed-off-by: Alx-Lai <alexabc722@gmail.com>
This commit is contained in:
parent
de8ae4fe08
commit
999490fae4
@ -171,6 +171,13 @@ function playground_text(playground, hidden = true) {
|
|||||||
"latency": (endTime - startTime) / 1000,
|
"latency": (endTime - startTime) / 1000,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (response.error != null && response.error != '') {
|
||||||
|
// output the error if there's any. e.g. timeout
|
||||||
|
result_block.innerText = response.error;
|
||||||
|
result_block.classList.remove("result-no-output");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (response.stdout.trim() === '') {
|
if (response.stdout.trim() === '') {
|
||||||
result_block.innerText = "No output";
|
result_block.innerText = "No output";
|
||||||
result_block.classList.add("result-no-output");
|
result_block.classList.add("result-no-output");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user