Added option for send mail if programming error
This commit is contained in:
parent
fe6a21e1d7
commit
49fafab88f
1 changed files with 39 additions and 0 deletions
39
paramecio/citoplasma/error_reporting.py
Normal file
39
paramecio/citoplasma/error_reporting.py
Normal 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue