Skip to content

Commit

Permalink
Tweaking error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
benedwards44 committed Nov 27, 2017
1 parent 3e6a063 commit 6b3efe8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion codescanner/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def scan_org(self):
if not component.get('success'):
errors.append(component.get('fullName') + ': ' + component.get('problem'))

self.job.error = 'There was an error compiling your code:\n- %s' % ('\n- '.join(errors))
self.job.error = 'Code compilation error:\n- %s' % ('\n- '.join(errors))
self.job.save()
return

Expand Down
2 changes: 1 addition & 1 deletion sfcodeclean/templates/job.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2 class="pull-right">{{ job.username }} <small>{{ job.org_id }}</small></h2>
{% if job.status == 'Error' %}
<div class="alert alert-danger" role="alert">
<em>There was an error running your scan:</em> <br/>
{{ job.error}}
{{ job.error|linebreaksbr }}
</div>
{% else %}

Expand Down
14 changes: 6 additions & 8 deletions sfcodeclean/templates/scanning.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ <h1 style="font-size:1.5em;margin-top:20px;">Scanning all Apex Code</h1>

<div class="error" style="display:none;">
<div class="alert alert-danger" role="alert">
<p>
There was an error processing your request: <i class="error_message"></i>
<br/><br/>
Please <a href="/">return</a> to the home page and try again.
</p>
There was an error processing your request:
<p id="error_message"></p>
<p>Please <a href="/">return</a> to the home page and try again.</p>
</div>
</div>

Expand All @@ -38,15 +36,15 @@ <h1 style="font-size:1.5em;margin-top:20px;">Scanning all Apex Code</h1>
dataType: 'json',
success: function(resp)
{
if (resp.status == 'Finished')
if (resp.status == 'Finished')
{
window.location = "{% url 'job' slug=object.slug %}";
}
else if (resp.status == 'Error')
{
$('.loading-components').hide();
$('.error').show();
$('.error_message').text(resp.error);
$('#error_message').html(resp.error.replace(/\n/g, "<br />"));
clearInterval(refreshId);
}
// Else job is still running, this will re-run shortly.
Expand All @@ -55,7 +53,7 @@ <h1 style="font-size:1.5em;margin-top:20px;">Scanning all Apex Code</h1>
{
$('.loading-components').hide();
$('.error').show();
$('.error_message').text(resp);
$('#error_message').html(resp);
clearInterval(refreshId);
}
});
Expand Down

0 comments on commit 6b3efe8

Please sign in to comment.