```ruby
module FaultsHelper
  def fault_detail(fault)
    text = ''
    fault['detail'].each do |k, v|
      text += "\n\n" if text != ''
      text += "#{k.upcase}:\n#{v}"
    end
    return text
  end
end
```

Fix crash when fault detail attribute is missing
user
```ruby
module FaultsHelper
  def fault_detail(fault)
    return '' if not fault['detail']
    text = ''
    fault['detail'].each do |k, v|
      text += "\n\n" if text != ''
      text += "#{k.upcase}:\n#{v}"
    end
    return text
  end
end
```
assistant