Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
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
Maunium
synapse
Commits
cd086412
Commit
cd086412
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Make postgres database error slightly more helpful
parent
4932a7e2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/app/homeserver.py
+15
-12
15 additions, 12 deletions
synapse/app/homeserver.py
synapse/storage/engines/postgres.py
+2
-1
2 additions, 1 deletion
synapse/storage/engines/postgres.py
with
17 additions
and
13 deletions
synapse/app/homeserver.py
+
15
−
12
View file @
cd086412
...
@@ -245,24 +245,27 @@ class SynapseHomeServer(HomeServer):
...
@@ -245,24 +245,27 @@ class SynapseHomeServer(HomeServer):
db_conn
.
cursor
(),
database_engine
,
self
.
hostname
db_conn
.
cursor
(),
database_engine
,
self
.
hostname
)
)
if
not
all_users_native
:
if
not
all_users_native
:
sys
.
stderr
.
write
(
quit_with_error
(
"
\n
"
"
******************************************************
\n
"
"
Found users in database not native to %s!
\n
"
"
Found users in database not native to %s!
\n
"
"
You cannot changed a synapse server_name after it
'
s been configured
\n
"
"
You cannot changed a synapse server_name after it
'
s been configured
"
"
******************************************************
\n
"
%
(
self
.
hostname
,)
"
\n
"
%
(
self
.
hostname
,)
)
)
sys
.
exit
(
1
)
try
:
try
:
database_engine
.
check_database
(
db_conn
.
cursor
())
database_engine
.
check_database
(
db_conn
.
cursor
())
except
IncorrectDatabaseSetup
as
e
:
except
IncorrectDatabaseSetup
as
e
:
sys
.
stderr
.
write
(
"
*
"
*
len
(
e
.
message
)
+
'
\n
'
)
quit_with_error
(
e
.
message
)
sys
.
stderr
.
write
(
e
.
message
)
sys
.
stderr
.
write
(
'
\n
'
)
sys
.
stderr
.
write
(
"
*
"
*
len
(
e
.
message
)
+
'
\n
'
)
def
quit_with_error
(
error_string
):
sys
.
exit
(
2
)
message_lines
=
error_string
.
split
(
"
\n
"
)
line_length
=
max
([
len
(
l
)
for
l
in
message_lines
])
+
2
sys
.
stderr
.
write
(
"
*
"
*
line_length
+
'
\n
'
)
for
line
in
message_lines
:
if
line
.
strip
():
sys
.
stderr
.
write
(
"
%s
\n
"
%
(
line
.
strip
(),))
sys
.
stderr
.
write
(
"
*
"
*
line_length
+
'
\n
'
)
sys
.
exit
(
1
)
def
get_version_string
():
def
get_version_string
():
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/engines/postgres.py
+
2
−
1
View file @
cd086412
...
@@ -28,7 +28,8 @@ class PostgresEngine(object):
...
@@ -28,7 +28,8 @@ class PostgresEngine(object):
rows
=
txn
.
fetchall
()
rows
=
txn
.
fetchall
()
if
rows
and
rows
[
0
][
0
]
!=
"
UTF8
"
:
if
rows
and
rows
[
0
][
0
]
!=
"
UTF8
"
:
raise
IncorrectDatabaseSetup
(
raise
IncorrectDatabaseSetup
(
"
Database has incorrect encoding:
'
%s
'
instead of
'
UTF8
'"
"
Database has incorrect encoding:
'
%s
'
instead of
'
UTF8
'
\n
"
"
See docs/postgres.rst for more information.
"
%
(
rows
[
0
][
0
],)
%
(
rows
[
0
][
0
],)
)
)
...
...
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