Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
117b636d
Commit
117b636d
authored
9 years ago
by
Christophe Simonis
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] mail: catch database errors when sending mails
parent
fc11b582
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
addons/mail/mail_mail.py
+8
-0
8 additions, 0 deletions
addons/mail/mail_mail.py
with
8 additions
and
0 deletions
addons/mail/mail_mail.py
+
8
−
0
View file @
117b636d
...
...
@@ -26,6 +26,8 @@ from email.utils import formataddr
from
urllib
import
urlencode
from
urlparse
import
urljoin
import
psycopg2
from
openerp
import
tools
from
openerp
import
SUPERUSER_ID
from
openerp.osv
import
fields
,
osv
...
...
@@ -338,6 +340,12 @@ class mail_mail(osv.Model):
# prevent catching transient MemoryErrors, bubble up to notify user or abort cron job
# instead of marking the mail as failed
raise
except
psycopg2
.
Error
:
# If an error with the database occurs, chances are that the cursor is unusable.
# This will lead to an `psycopg2.InternalError` being raised when trying to write
# `state`, shadowing the original exception and forbid a retry on concurrent
# update. Let's bubble it.
raise
except
Exception
:
_logger
.
exception
(
'
failed sending mail.mail %s
'
,
mail
.
id
)
mail
.
write
({
'
state
'
:
'
exception
'
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment