Added option for send mail if programming error

This commit is contained in:
Antonio de la Rosa 2018-06-14 21:58:15 +02:00
parent fe6a21e1d7
commit 49fafab88f

View file

@ -0,0 +1,39 @@
#!/usr/bin/env python3
# A bottle plugin for send emails if
from settings import config
from paramecio.citoplasma.sendmail import SendMail
class ErrorReportingPlugin(object):
name = 'login'
api = 2
def apply(self, callback, context):
def wrapper(*args, **kwargs):
try:
rv = callback(*args, **kwargs)
return rv
except:
#print('detected error')
# Send mail with error.
"""
sendmail=SendMail()
sendmail.send(email_failed, [email_failed], 'Hubo un error al añadir el mail a mailchimp', r.text, content_type='plain', attachments=[])
print(post.post['email']+'error in mailchimp: '+r.text)
rv = callback(*args, **kwargs)
"""
raise
#return rv
return wrapper