Skip to content

Commit 0a999e1

Browse files
committed
Unify error messages
... for translatability purposes.
1 parent 5c47049 commit 0a999e1

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

src/backend/storage/ipc/latch.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,9 @@ WaitEventAdjustEpoll(WaitEventSet *set, WaitEvent *event, int action)
856856
if (rc < 0)
857857
ereport(ERROR,
858858
(errcode_for_socket_access(),
859-
errmsg("epoll_ctl() failed: %m")));
859+
/* translator: %s is a syscall name, such as "poll()" */
860+
errmsg("%s failed: %m",
861+
"epoll_ctl()")));
860862
}
861863
#endif
862864

@@ -1087,7 +1089,9 @@ WaitEventSetWaitBlock(WaitEventSet *set, int cur_timeout,
10871089
waiting = false;
10881090
ereport(ERROR,
10891091
(errcode_for_socket_access(),
1090-
errmsg("epoll_wait() failed: %m")));
1092+
/* translator: %s is a syscall name, such as "poll()" */
1093+
errmsg("%s failed: %m",
1094+
"epoll_wait()")));
10911095
}
10921096
return 0;
10931097
}
@@ -1211,7 +1215,9 @@ WaitEventSetWaitBlock(WaitEventSet *set, int cur_timeout,
12111215
waiting = false;
12121216
ereport(ERROR,
12131217
(errcode_for_socket_access(),
1214-
errmsg("poll() failed: %m")));
1218+
/* translator: %s is a syscall name, such as "poll()" */
1219+
errmsg("%s failed: %m",
1220+
"poll()")));
12151221
}
12161222
return 0;
12171223
}

src/backend/storage/ipc/signalfuncs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ pg_rotate_logfile(PG_FUNCTION_ARGS)
181181
ereport(ERROR,
182182
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
183183
(errmsg("must be superuser to rotate log files with adminpack 1.0"),
184-
errhint("Consider using pg_logfile_rotate(), which is part of core, instead."))));
184+
/* translator: %s is a SQL function name */
185+
errhint("Consider using %s, which is part of core, instead.",
186+
"pg_logfile_rotate()"))));
185187

186188
if (!Logging_collector)
187189
{

src/backend/utils/adt/formatting.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,8 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
15661566
*/
15671567
ereport(ERROR,
15681568
(errcode(ERRCODE_INDETERMINATE_COLLATION),
1569-
errmsg("could not determine which collation to use for lower() function"),
1569+
errmsg("could not determine which collation to use for %s function",
1570+
"lower()"),
15701571
errhint("Use the COLLATE clause to set the collation explicitly.")));
15711572
}
15721573
mylocale = pg_newlocale_from_collation(collid);
@@ -1688,7 +1689,8 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
16881689
*/
16891690
ereport(ERROR,
16901691
(errcode(ERRCODE_INDETERMINATE_COLLATION),
1691-
errmsg("could not determine which collation to use for upper() function"),
1692+
errmsg("could not determine which collation to use for %s function",
1693+
"upper()"),
16921694
errhint("Use the COLLATE clause to set the collation explicitly.")));
16931695
}
16941696
mylocale = pg_newlocale_from_collation(collid);
@@ -1811,7 +1813,8 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
18111813
*/
18121814
ereport(ERROR,
18131815
(errcode(ERRCODE_INDETERMINATE_COLLATION),
1814-
errmsg("could not determine which collation to use for initcap() function"),
1816+
errmsg("could not determine which collation to use for %s function",
1817+
"initcap()"),
18151818
errhint("Use the COLLATE clause to set the collation explicitly.")));
18161819
}
18171820
mylocale = pg_newlocale_from_collation(collid);

src/backend/utils/adt/genfile.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ pg_read_file(PG_FUNCTION_ARGS)
219219
ereport(ERROR,
220220
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
221221
(errmsg("must be superuser to read files with adminpack 1.0"),
222-
errhint("Consider using pg_file_read(), which is part of core, instead."))));
222+
/* translator: %s is a SQL function name */
223+
errhint("Consider using %s, which is part of core, instead.",
224+
"pg_file_read()"))));
223225

224226
/* handle optional arguments */
225227
if (PG_NARGS() >= 3)

src/backend/utils/adt/json.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,9 @@ json_build_object(PG_FUNCTION_ARGS)
21922192
ereport(ERROR,
21932193
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
21942194
errmsg("argument list must have even number of elements"),
2195-
errhint("The arguments of json_build_object() must consist of alternating keys and values.")));
2195+
/* translator: %s is a SQL function name */
2196+
errhint("The arguments of %s must consist of alternating keys and values.",
2197+
"json_build_object()")));
21962198

21972199
result = makeStringInfo();
21982200

src/backend/utils/adt/jsonb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,9 @@ jsonb_build_object(PG_FUNCTION_ARGS)
11551155
ereport(ERROR,
11561156
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
11571157
errmsg("argument list must have even number of elements"),
1158-
errhint("The arguments of jsonb_build_object() must consist of alternating keys and values.")));
1158+
/* translator: %s is a SQL function name */
1159+
errhint("The arguments of %s must consist of alternating keys and values.",
1160+
"jsonb_build_object()")));
11591161

11601162
memset(&result, 0, sizeof(JsonbInState));
11611163

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy