I'm developing an application where a lot of errors could occur. So I - and the administrators who shall use this application - have a lot of interest in logging all relevant information. But I'm struggling with ruby style guides. I love the rubocop defaults and normaly code fits in most cases. But with logging there have to be a lot more lines of code than in a normal application.
For Example see this construct
def do_something
client.connect
rescue FirstErrorType => e
Logger.warn('Client') { "This is an error message for my Client: '#{e}'" }
sleep 10
retry
rescue SecondErrorType => e
Logger.warn('Client') {"This is an other error message for my Client: '#{e}'" }
sleep 5
retry
rescue ThirdErrorType => e
Logger.warn('Client') {"And even a third error message for my Client: '#{e}' "}
sleep 30
retry
end
end
Is there a trick or a common pattern for logging sich errors in a style guide conform way? Or do I have to ignore style guide in this cases?