user1252307 answer is a great start, but on the sentry side you get a relatively unhelpful dictionary and no stack trace.
If you are trying to view and track down unexpected exceptions try this small change to the log_sentry function:
from twisted.python import log
from raven import Client
client = Client(dsn='twisted+http://YOUR_DSN_HERE')
def log_sentry(dictionary):
if dictionary.get('isError'):
if 'failure' in dictionary:
client.captureException() # Send the current exception info to Sentry.
else:
#format the dictionary in whatever way you want
client.captureMessage(dictionary)
log.addObserver(log_sentry)
There maybe a better way to filter non exception based error message, and this might try to emit exception information that doesn't exist where there are failures which aren't exceptions.