Closed kylebrandt closed 7 years ago
You can now check if nil, but we haven't updated the alert code to do that yet. But regardless the panic should be recovered:
{{ template "header" . }}
{{ $jq := .HTTPGetJSON "http://ny-tps.ds.stackexchange.com/top-ips" }}
{{ $topIPs := $jq.ArrayOfObjects "topIps" }}
<table>
<tr>
<th>IP Address</th>
<th>Hits in the last {{$jq.Int "spanMinutes"}} minutes</th>
<th>Country</th>
<th>City</th>
<th>Crawler</th>
<th>Whois ORG (Via ARIN API)</th>
<tr>
{{ range $i, $ip := $topIPs }}
{{ if lt $i 10 }}
<tr>
I thought all of template execution was wrapped in defer, but just sections of it. Going to wrap all of it (since user input) tomorrow and make sure that protects things.
This type of panic can not be wrapped in a recover, see https://stackoverflow.com/questions/43212593/handling-sigsegv-with-recover
closing a dupe of the newer issue https://github.com/bosun-monitor/bosun/issues/2121
Maybe something with the template error handling changes?