Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
20wildmanj committed Nov 1, 2023
1 parent ebe57fd commit 67e879d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions app/controllers/scoreboards_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def show
"createScoreboardEntry(#{grade[:problems].inspect},\n"\
"#{grade[:autoresult]})"
@error = e
Rails.logger.error("Scoreboard error in #{@course.name}/#{@assessment.name}: #{@error}")
render("scoreboards/edit") && return
end
end
Expand Down Expand Up @@ -254,6 +255,8 @@ def createScoreboardEntry(scores, autoresult)
flash[:error] = "Error parsing scoreboard for autograded assessment: scoreboard result is"\
" not an array. Please ensure that the autograder returns scoreboard results as an array."
end
Rails.logger.error("Scoreboard error in #{@course.name}/#{@assessment.name}: " \
"Scoreboard result is not an array")
raise if !parsed || !parsed["scoreboard"] || !parsed["scoreboard"].is_a?(Array)
rescue StandardError
# If there is no autoresult for this student (typically
Expand All @@ -274,6 +277,8 @@ def createScoreboardEntry(scores, autoresult)
flash[:error] = "Error parsing scoreboard for autograded assessment: Please ensure the"\
" scoreboard results from the autograder are formatted to be an array, and the colspec"\
" matches the expected format."
Rails.logger.error("Scoreboard error in #{@course.name}/#{@assessment.name}: " \
"Scoreboard could not be parsed")
end
# Give up and bail
return ["-"]
Expand Down
2 changes: 1 addition & 1 deletion app/views/scoreboards/_error_icon.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
error_outline
</i>
</div>
</td>
</td>
6 changes: 3 additions & 3 deletions app/views/scoreboards/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<% unless @errorMessage.nil? %>
<h4 class="error-header">Error Rendering Scoreboard:</h4>
<div>
<pre style="text-wrap: wrap;"><%= @errorMessage %></pre>
<pre><%= @error %></pre>
<pre style="text-wrap: wrap;"><%= @errorMessage %></pre>
<pre><%= @error %></pre>
</div>
<% end %>
<% end %>
<%= f.error_messages %>
<h3>Scoreboard Settings</h3>
<p>
Expand Down

0 comments on commit 67e879d

Please sign in to comment.