Skip to content
Snippets Groups Projects
Commit 279a547a authored by Erik Johnston's avatar Erik Johnston
Browse files

Use generic db exceptions rather than sqlite3 specific ones

parent a43b4044
No related branches found
No related tags found
No related merge requests found
......@@ -21,8 +21,6 @@ from twisted.internet import defer
from collections import namedtuple
import sqlite3
RoomAliasMapping = namedtuple(
"RoomAliasMapping",
......@@ -91,7 +89,7 @@ class DirectoryStore(SQLBaseStore):
},
desc="create_room_alias_association",
)
except sqlite3.IntegrityError:
except self.database_engine.module.IntegrityError:
raise SynapseError(
409, "Room alias %s already exists" % room_alias.to_string()
)
......
......@@ -15,8 +15,6 @@
from twisted.internet import defer
from sqlite3 import IntegrityError
from synapse.api.errors import StoreError, Codes
from ._base import SQLBaseStore, cached
......@@ -76,7 +74,7 @@ class RegistrationStore(SQLBaseStore):
txn.execute("INSERT INTO users(name, password_hash, creation_ts) "
"VALUES (?,?,?)",
[user_id, password_hash, now])
except IntegrityError:
except self.database_engine.module.IntegrityError:
raise StoreError(
400, "User ID already taken.", errcode=Codes.USER_IN_USE
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment