Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 26d40ad

Browse files
committed
Message style improvements
1 parent 620b49a commit 26d40ad

File tree

8 files changed

+29
-25
lines changed

8 files changed

+29
-25
lines changed

src/bin/pg_archivecleanup/pg_archivecleanup.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ SetWALFileNameForCleanup(void)
245245

246246
if (!fnameOK)
247247
{
248-
fprintf(stderr, _("%s: invalid filename input\n"), progname);
248+
fprintf(stderr, _("%s: invalid file name argument\n"), progname);
249249
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
250250
exit(2);
251251
}
@@ -350,14 +350,14 @@ main(int argc, char **argv)
350350
}
351351
else
352352
{
353-
fprintf(stderr, _("%s: must specify restartfilename\n"), progname);
353+
fprintf(stderr, _("%s: must specify oldest kept WAL file\n"), progname);
354354
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
355355
exit(2);
356356
}
357357

358358
if (optind < argc)
359359
{
360-
fprintf(stderr, _("%s: too many parameters\n"), progname);
360+
fprintf(stderr, _("%s: too many command-line arguments\n"), progname);
361361
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
362362
exit(2);
363363
}
@@ -376,7 +376,7 @@ main(int argc, char **argv)
376376
{
377377
snprintf(WALFilePath, MAXPGPATH, "%s/%s",
378378
archiveLocation, exclusiveCleanupFileName);
379-
fprintf(stderr, _("%s: keep WAL file \"%s\" and later\n"),
379+
fprintf(stderr, _("%s: keeping WAL file \"%s\" and later\n"),
380380
progname, WALFilePath);
381381
}
382382

src/bin/pg_basebackup/pg_receivewal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ FindStreamingStart(uint32 *tli)
280280
}
281281
if (lseek(fd, (off_t) (-4), SEEK_END) < 0)
282282
{
283-
fprintf(stderr, _("%s: could not seek compressed file \"%s\": %s\n"),
283+
fprintf(stderr, _("%s: could not seek in compressed file \"%s\": %s\n"),
284284
progname, fullpath, strerror(errno));
285285
disconnect_and_exit(1);
286286
}

src/bin/pg_basebackup/receivelog.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ open_walfile(StreamCtl *stream, XLogRecPtr startpoint)
136136
if (stream->walmethod->sync(f) != 0)
137137
{
138138
fprintf(stderr,
139-
_("%s: could not sync existing write-ahead log file \"%s\": %s\n"),
139+
_("%s: could not fsync existing write-ahead log file \"%s\": %s\n"),
140140
progname, fn, stream->walmethod->getlasterror());
141141
stream->walmethod->close(f, CLOSE_UNLINK);
142142
return false;
@@ -151,7 +151,9 @@ open_walfile(StreamCtl *stream, XLogRecPtr startpoint)
151151
if (errno == 0)
152152
errno = ENOSPC;
153153
fprintf(stderr,
154-
_("%s: write-ahead log file \"%s\" has %d bytes, should be 0 or %d\n"),
154+
ngettext("%s: write-ahead log file \"%s\" has %d byte, should be 0 or %d\n",
155+
"%s: write-ahead log file \"%s\" has %d bytes, should be 0 or %d\n",
156+
size),
155157
progname, fn, (int) size, XLogSegSize);
156158
return false;
157159
}

src/bin/pg_basebackup/walmethods.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ tar_write_compressed_data(void *buf, size_t count, bool flush)
432432
r = deflate(tar_data->zp, flush ? Z_FINISH : Z_NO_FLUSH);
433433
if (r == Z_STREAM_ERROR)
434434
{
435-
tar_set_error("deflate failed");
435+
tar_set_error("could not compress data");
436436
return false;
437437
}
438438

@@ -456,7 +456,7 @@ tar_write_compressed_data(void *buf, size_t count, bool flush)
456456
/* Reset the stream for writing */
457457
if (deflateReset(tar_data->zp) != Z_OK)
458458
{
459-
tar_set_error("deflateReset failed");
459+
tar_set_error("could not reset compression stream");
460460
return false;
461461
}
462462
}
@@ -557,7 +557,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
557557
{
558558
pg_free(tar_data->zp);
559559
tar_data->zp = NULL;
560-
tar_set_error("deflateInit2 failed");
560+
tar_set_error("could not initialize compression library");
561561
return NULL;
562562
}
563563
}
@@ -569,7 +569,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
569569
Assert(tar_data->currentfile == NULL);
570570
if (tar_data->currentfile != NULL)
571571
{
572-
tar_set_error("implementation error: tar files can't have more than one open file\n");
572+
tar_set_error("implementation error: tar files can't have more than one open file");
573573
return NULL;
574574
}
575575

@@ -597,7 +597,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
597597
/* Turn off compression for header */
598598
if (deflateParams(tar_data->zp, 0, 0) != Z_OK)
599599
{
600-
tar_set_error("deflateParams failed");
600+
tar_set_error("could not change compression parameters");
601601
return NULL;
602602
}
603603
}
@@ -635,7 +635,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
635635
/* Re-enable compression for the rest of the file */
636636
if (deflateParams(tar_data->zp, tar_data->compression, 0) != Z_OK)
637637
{
638-
tar_set_error("deflateParams failed");
638+
tar_set_error("could not change compression parameters");
639639
return NULL;
640640
}
641641
}
@@ -824,7 +824,7 @@ tar_close(Walfile f, WalCloseMethod method)
824824
/* Turn off compression */
825825
if (deflateParams(tar_data->zp, 0, 0) != Z_OK)
826826
{
827-
tar_set_error("deflateParams failed");
827+
tar_set_error("could not change compression parameters");
828828
return -1;
829829
}
830830

@@ -835,7 +835,7 @@ tar_close(Walfile f, WalCloseMethod method)
835835
/* Turn compression back on */
836836
if (deflateParams(tar_data->zp, tar_data->compression, 0) != Z_OK)
837837
{
838-
tar_set_error("deflateParams failed");
838+
tar_set_error("could not change compression parameters");
839839
return -1;
840840
}
841841
}
@@ -901,7 +901,7 @@ tar_finish(void)
901901

902902
if (r == Z_STREAM_ERROR)
903903
{
904-
tar_set_error("deflate failed");
904+
tar_set_error("could not compress data");
905905
return false;
906906
}
907907
if (tar_data->zp->avail_out < ZLIB_OUT_SIZE)
@@ -917,7 +917,7 @@ tar_finish(void)
917917

918918
if (deflateEnd(tar_data->zp) != Z_OK)
919919
{
920-
tar_set_error("deflateEnd failed");
920+
tar_set_error("could not close compression stream");
921921
return false;
922922
}
923923
}

src/interfaces/libpq/fe-auth-scram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ build_client_first_message(fe_scram_state *state, PQExpBuffer errormessage)
308308
if (!pg_frontend_random(raw_nonce, SCRAM_RAW_NONCE_LEN))
309309
{
310310
printfPQExpBuffer(errormessage,
311-
libpq_gettext("failed to generate nonce\n"));
311+
libpq_gettext("could not generate nonce\n"));
312312
return NULL;
313313
}
314314

src/pl/plpython/expected/plpython_types.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ CREATE FUNCTION test_type_conversion_mdarray_malformed() RETURNS int[] AS $$
691691
return [[1,2,3],[4,5]]
692692
$$ LANGUAGE plpythonu;
693693
SELECT * FROM test_type_conversion_mdarray_malformed();
694-
ERROR: multidimensional arrays must have array expressions with matching dimensions. PL/Python function return value has sequence length 2 while expected 3
694+
ERROR: wrong length of inner sequence: has length 2, but 3 was expected
695+
DETAIL: To construct a multidimensional array, the inner sequences must all have the same length.
695696
CONTEXT: while creating return value
696697
PL/Python function "test_type_conversion_mdarray_malformed"
697698
CREATE FUNCTION test_type_conversion_mdarray_toodeep() RETURNS int[] AS $$

src/pl/plpython/expected/plpython_types_3.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ CREATE FUNCTION test_type_conversion_mdarray_malformed() RETURNS int[] AS $$
691691
return [[1,2,3],[4,5]]
692692
$$ LANGUAGE plpython3u;
693693
SELECT * FROM test_type_conversion_mdarray_malformed();
694-
ERROR: multidimensional arrays must have array expressions with matching dimensions. PL/Python function return value has sequence length 2 while expected 3
694+
ERROR: wrong length of inner sequence: has length 2, but 3 was expected
695+
DETAIL: To construct a multidimensional array, the inner sequences must all have the same length.
695696
CONTEXT: while creating return value
696697
PL/Python function "test_type_conversion_mdarray_malformed"
697698
CREATE FUNCTION test_type_conversion_mdarray_toodeep() RETURNS int[] AS $$

src/pl/plpython/plpy_typeio.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ PLySequence_ToArray(PLyObToDatum *arg, int32 typmod, PyObject *plrv, bool inarra
10021002

10031003
dims[ndim] = PySequence_Length(pyptr);
10041004
if (dims[ndim] < 0)
1005-
PLy_elog(ERROR, "cannot determine sequence length for function return value");
1005+
PLy_elog(ERROR, "could not determine sequence length for function return value");
10061006

10071007
if (dims[ndim] > MaxAllocSize)
10081008
PLy_elog(ERROR, "array size exceeds the maximum allowed");
@@ -1087,10 +1087,10 @@ PLySequence_ToArray_recurse(PLyObToDatum *elm, PyObject *list,
10871087
int i;
10881088

10891089
if (PySequence_Length(list) != dims[dim])
1090-
PLy_elog(ERROR,
1091-
"multidimensional arrays must have array expressions with matching dimensions. "
1092-
"PL/Python function return value has sequence length %d while expected %d",
1093-
(int) PySequence_Length(list), dims[dim]);
1090+
ereport(ERROR,
1091+
(errmsg("wrong length of inner sequence: has length %d, but %d was expected",
1092+
(int) PySequence_Length(list), dims[dim]),
1093+
(errdetail("To construct a multidimensional array, the inner sequences must all have the same length."))));
10941094

10951095
if (dim < ndim - 1)
10961096
{

0 commit comments

Comments
 (0)