Commit ee8073c5 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Better code for reflecting createsliver error messages back to user.

parent a53e7231
......@@ -308,7 +308,9 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
bgtype = "panel-danger";
if (_.has(json.value, "reason")) {
status_message = json.value.reason;
status_message = "Something went wrong!";
$('#error_panel_text').text(json.value.reason);
$('#error_panel').removeClass("hidden");
}
else {
status_message = "Something went wrong, sorry! " +
......
<?php
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -89,12 +89,14 @@ function Do_GetInstanceStatus()
$blob["status"] = $instance->status();
$webtask = WebTask::LookupByObject($instance->uuid());
if ($webtask) {
# We do not want to tell the user anything unless it would mean
# something to them. Not enough nodes is important.
if ($webtask && $webtask->exited()) {
# Reflect errors back to the user.
if ($webtask->exitcode() == 26) {
$blob["reason"] = "Not enough free nodes, please try again later.";
}
else {
$blob["reason"] = htmlentities($webtask->TaskValue("output"));
}
}
SPITAJAX_RESPONSE($blob);
}
......
......@@ -91,6 +91,22 @@
</div>
</div>
</div>
<!-- Add a hidden div for errors returned by the instantiation. -->
<div class='row hidden' id='error_panel'>
<div class='col-lg-6 col-lg-offset-3
col-md-8 col-md-offset-2
col-sm-8 col-sm-offset-2
col-xs-12 col-xs-offset-0'>
<div class="panel panel-danger">
<div class="panel-heading">
<center><h4>Error Message</h4></center>
</div>
<div class="panel-body">
<code id="error_panel_text"></code>
</div>
</div>
</div>
</div>
<!-- Add a div for the instructions if there are instructions. The cliet
will actually fill in the div though, since it is markdown and that
is more easily done on the client side for now. -->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment