diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4e742b4a7..6fc4f115f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -65,7 +65,7 @@ Memory is allocated inside contexts and can be long lasting (for objects) or tem
Logging is used for debugging with the built-in macros `FUNCTION_LOG_*()` and `FUNCTION_TEST_*()` which are used to trace parameters passed to/returned from functions. `FUNCTION_LOG_*()` macros are used for production logging whereas `FUNCTION_TEST_*()` macros will be compiled out of production code. For functions where no parameter is valuable enough to justify the cost of debugging in production, use `FUNCTION_TEST_BEGIN()/FUNCTION_TEST_END()`, else use `FUNCTION_LOG_BEGIN(someLogLevel)/FUNCTION_LOG_END()`. See [debug.h](https://github.com/pgbackrest/pgbackrest/blob/main/src/common/debug.h) for more details and the [Coding Example](#coding-example) below.
-Logging is also used for providing information to the user via the `LOG_*()` macros, such as `LOG_INFO("some informational message")` and `LOG_WARN_FMT("no prior backup exists, %s backup has been changed to full", strZ(cfgOptionDisplay(cfgOptType)))` and also via `THROW_*()` macros for throwing an error. See [log.h](https://github.com/pgbackrest/pgbackrest/blob/main/src/common/log.h) and [error.h](https://github.com/pgbackrest/pgbackrest/blob/main/src/common/error.h) for more details and the [Coding Example](#coding-example) below.
+Logging is also used for providing information to the user via the `LOG_*()` macros, such as `LOG_INFO("some informational message")` and `LOG_WARN_FMT("no prior backup exists, %s backup has been changed to full", strZ(cfgOptionDisplay(cfgOptType)))` and also via `THROW_*()` macros for throwing an error. See [log.h](https://github.com/pgbackrest/pgbackrest/blob/main/src/common/log.h) and [error.h](https://github.com/pgbackrest/pgbackrest/blob/main/src/common/error/error.h) for more details and the [Coding Example](#coding-example) below.
### Coding Example
diff --git a/doc/xml/contributing.xml b/doc/xml/contributing.xml
index 49bde9c18..3bbf00e85 100644
--- a/doc/xml/contributing.xml
+++ b/doc/xml/contributing.xml
@@ -165,7 +165,7 @@
Logging is used for debugging with the built-in macros FUNCTION_LOG_*() and FUNCTION_TEST_*() which are used to trace parameters passed to/returned from functions. FUNCTION_LOG_*() macros are used for production logging whereas FUNCTION_TEST_*() macros will be compiled out of production code. For functions where no parameter is valuable enough to justify the cost of debugging in production, use FUNCTION_TEST_BEGIN()/FUNCTION_TEST_END(), else use FUNCTION_LOG_BEGIN(someLogLevel)/FUNCTION_LOG_END(). See debug.h for more details and the Coding Example below.
-
Logging is also used for providing information to the user via the LOG_*() macros, such as LOG_INFO("some informational message") and LOG_WARN_FMT("no prior backup exists, %s backup has been changed to full", strZ(cfgOptionDisplay(cfgOptType))) and also via THROW_*() macros for throwing an error. See log.h and error.h for more details and the Coding Example below.
+
Logging is also used for providing information to the user via the LOG_*() macros, such as LOG_INFO("some informational message") and LOG_WARN_FMT("no prior backup exists, %s backup has been changed to full", strZ(cfgOptionDisplay(cfgOptType))) and also via THROW_*() macros for throwing an error. See log.h and error.h for more details and the Coding Example below.
diff --git a/src/Makefile.in b/src/Makefile.in
index a8c5647e0..a67c36360 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -10,7 +10,7 @@ SRCS_COMMON = \
common/compress/bz2/compress.c \
common/debug.c \
common/encode.c \
- common/error.c \
+ common/error/error.c \
common/io/filter/buffer.c \
common/io/filter/filter.c \
common/io/filter/group.c \
diff --git a/src/build/error/error.yaml b/src/build/error/error.yaml
index c15ea6973..242d32306 100644
--- a/src/build/error/error.yaml
+++ b/src/build/error/error.yaml
@@ -1,6 +1,6 @@
# Error Definitions
#
-# Definitions for all C errors, auto-generated to src/common/error.auto.c.inc/.h.
+# Definitions for all C errors, auto-generated to src/common/error/error.auto.c.inc/.h.
# Errors in the code that it should not be possible for the user to encounter -- i.e., a likely bug
assert:
diff --git a/src/build/error/render.c b/src/build/error/render.c
index 384d86ae3..f8d1aa932 100644
--- a/src/build/error/render.c
+++ b/src/build/error/render.c
@@ -52,8 +52,8 @@ bldErrRenderErrorAutoH(const Storage *const storageRepo, const BldErr bldErr)
String *error = strCatFmt(
strNew(),
"%s"
- "#ifndef COMMON_ERROR_AUTO_H\n"
- "#define COMMON_ERROR_AUTO_H\n",
+ "#ifndef COMMON_ERROR_ERROR_AUTO_H\n"
+ "#define COMMON_ERROR_ERROR_AUTO_H\n",
strZ(bldHeader(ERROR_MODULE, ERROR_AUTO_COMMENT)));
// Error declarations
@@ -78,7 +78,7 @@ bldErrRenderErrorAutoH(const Storage *const storageRepo, const BldErr bldErr)
"\n"
"#endif\n");
- bldPut(storageRepo, "src/common/error.auto.h", BUFSTR(error));
+ bldPut(storageRepo, "src/common/error/error.auto.h", BUFSTR(error));
}
/***********************************************************************************************************************************
@@ -130,7 +130,7 @@ bldErrRenderErrorAutoC(const Storage *const storageRepo, const BldErr bldErr)
" NULL,\n"
"};\n");
- bldPut(storageRepo, "src/common/error.auto.c.inc", BUFSTR(error));
+ bldPut(storageRepo, "src/common/error/error.auto.c.inc", BUFSTR(error));
}
/**********************************************************************************************************************************/
diff --git a/src/command/exit.c b/src/command/exit.c
index 32bf796b7..363e1bb20 100644
--- a/src/command/exit.c
+++ b/src/command/exit.c
@@ -9,7 +9,6 @@ Exit Routines
#include "command/command.h"
#include "command/exit.h"
#include "common/debug.h"
-#include "common/error.h"
#include "common/lock.h"
#include "common/log.h"
#include "config/config.h"
diff --git a/src/common/assert.h b/src/common/assert.h
index 368cacced..5f6fcb7d3 100644
--- a/src/common/assert.h
+++ b/src/common/assert.h
@@ -4,7 +4,7 @@ Assert Routines
#ifndef COMMON_ASSERT_H
#define COMMON_ASSERT_H
-#include "common/error.h"
+#include "common/error/error.h"
/***********************************************************************************************************************************
Asserts are used in test code to ensure that certain conditions are true. They are omitted from production builds.
diff --git a/src/common/crypto/common.c b/src/common/crypto/common.c
index e07dfbb31..be953008b 100644
--- a/src/common/crypto/common.c
+++ b/src/common/crypto/common.c
@@ -11,7 +11,6 @@ Crypto Common
#include "common/crypto/common.h"
#include "common/debug.h"
-#include "common/error.h"
#include "common/log.h"
/***********************************************************************************************************************************
diff --git a/src/common/encode.c b/src/common/encode.c
index d0d23cd76..e5d3d06f3 100644
--- a/src/common/encode.c
+++ b/src/common/encode.c
@@ -8,7 +8,6 @@ Binary to String Encode/Decode
#include "common/debug.h"
#include "common/encode.h"
-#include "common/error.h"
/***********************************************************************************************************************************
Assert that encoding type is valid. This needs to be kept up to date with the last item in the enum.
diff --git a/src/common/error.auto.c.inc b/src/common/error/error.auto.c.inc
similarity index 100%
rename from src/common/error.auto.c.inc
rename to src/common/error/error.auto.c.inc
diff --git a/src/common/error.auto.h b/src/common/error/error.auto.h
similarity index 97%
rename from src/common/error.auto.h
rename to src/common/error/error.auto.h
index ad09c35e2..08c932abb 100644
--- a/src/common/error.auto.h
+++ b/src/common/error/error.auto.h
@@ -3,8 +3,8 @@ Error Type Definition
Automatically generated by 'build-code error' -- do not modify directly.
***********************************************************************************************************************************/
-#ifndef COMMON_ERROR_AUTO_H
-#define COMMON_ERROR_AUTO_H
+#ifndef COMMON_ERROR_ERROR_AUTO_H
+#define COMMON_ERROR_ERROR_AUTO_H
/***********************************************************************************************************************************
Error type declarations
diff --git a/src/common/error.c b/src/common/error/error.c
similarity index 99%
rename from src/common/error.c
rename to src/common/error/error.c
index d70077036..85200f01e 100644
--- a/src/common/error.c
+++ b/src/common/error/error.c
@@ -9,7 +9,7 @@ Error Handler
#include
#include
-#include "common/error.h"
+#include "common/error/error.h"
#include "common/macro.h"
#include "common/stackTrace.h"
@@ -34,7 +34,7 @@ ERROR_DEFINE(1, TestError, false, RuntimeError);
#endif
// Include error type definitions
-#include "common/error.auto.c.inc"
+#include "common/error/error.auto.c.inc"
/***********************************************************************************************************************************
Maximum allowed number of nested try blocks
diff --git a/src/common/error.h b/src/common/error/error.h
similarity index 99%
rename from src/common/error.h
rename to src/common/error/error.h
index afc72c298..992cceb72 100644
--- a/src/common/error.h
+++ b/src/common/error/error.h
@@ -34,8 +34,8 @@ gcc's -Wclobbered warnings are almost entirely useless for catching such issues.
IMPORTANT: Never call return from within any of the error-handling blocks.
***********************************************************************************************************************************/
-#ifndef COMMON_ERROR_H
-#define COMMON_ERROR_H
+#ifndef COMMON_ERROR_ERROR_H
+#define COMMON_ERROR_ERROR_H
#include
#include
@@ -51,7 +51,7 @@ typedef struct ErrorType ErrorType;
VR_EXTERN_DECLARE const ErrorType name
// Include error type declarations
-#include "common/error.auto.h"
+#include "common/error/error.auto.h"
// Declare test error
#ifdef DEBUG
diff --git a/src/common/fork.c b/src/common/fork.c
index 9ed26ff60..8b6741169 100644
--- a/src/common/fork.c
+++ b/src/common/fork.c
@@ -8,7 +8,6 @@ Fork Handler
#include
#include "common/debug.h"
-#include "common/error.h"
#include "common/log.h"
/**********************************************************************************************************************************/
diff --git a/src/common/log.c b/src/common/log.c
index a19501557..bf15e0942 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -13,7 +13,6 @@ Log Handler
#include
#include "common/debug.h"
-#include "common/error.h"
#include "common/log.h"
#include "common/time.h"
diff --git a/src/common/memContext.c b/src/common/memContext.c
index 082847124..05a179af7 100644
--- a/src/common/memContext.c
+++ b/src/common/memContext.c
@@ -7,7 +7,6 @@ Memory Context Manager
#include
#include "common/debug.h"
-#include "common/error.h"
#include "common/macro.h"
#include "common/memContext.h"
diff --git a/src/common/memContext.h b/src/common/memContext.h
index 81016bfc9..6a7e9b656 100644
--- a/src/common/memContext.h
+++ b/src/common/memContext.h
@@ -12,6 +12,7 @@ See the sections on memory context management and memory allocations below for m
#ifndef COMMON_MEMCONTEXT_H
#define COMMON_MEMCONTEXT_H
+#include
#include
#include
@@ -20,7 +21,6 @@ Memory context object
***********************************************************************************************************************************/
typedef struct MemContext MemContext;
-#include "common/error.h"
#include "common/type/param.h"
/***********************************************************************************************************************************
diff --git a/src/common/stackTrace.c b/src/common/stackTrace.c
index e28c5955f..274a27793 100644
--- a/src/common/stackTrace.c
+++ b/src/common/stackTrace.c
@@ -13,7 +13,6 @@ Stack Trace Handler
#endif
#include "common/assert.h"
-#include "common/error.h"
#include "common/macro.h"
#include "common/stackTrace.h"
@@ -324,7 +323,7 @@ stackTraceBackCallback(
{
fileName = stackTraceTrimSrc(fileName);
- if (strcmp(fileName, "common/error.c") == 0)
+ if (strcmp(fileName, "common/error/error.c") == 0)
return false;
data->result += stackTraceFmt(
diff --git a/src/config/config.c b/src/config/config.c
index e1a87641d..61d15b562 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -7,7 +7,6 @@ Command and Option Configuration
#include
#include "common/debug.h"
-#include "common/error.h"
#include "common/memContext.h"
#include "config/config.intern.h"
#include "config/parse.h"
diff --git a/src/config/parse.c b/src/config/parse.c
index fe06dab67..4c494bff3 100644
--- a/src/config/parse.c
+++ b/src/config/parse.c
@@ -10,7 +10,6 @@ Command and Option Parse
#include
#include "common/debug.h"
-#include "common/error.h"
#include "common/ini.h"
#include "common/io/bufferRead.h"
#include "common/log.h"
diff --git a/src/main.c b/src/main.c
index 5ed15a275..1781be3a2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -35,7 +35,6 @@ Main
#include "command/stanza/upgrade.h"
#include "command/verify/verify.h"
#include "common/debug.h"
-#include "common/error.h"
#include "common/io/fdRead.h"
#include "common/io/fdWrite.h"
#include "common/stat.h"
diff --git a/src/meson.build b/src/meson.build
index efb5158a5..46dfa9304 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -27,7 +27,7 @@ configure_file(output: 'build.auto.h', configuration: configuration)
src_common = files(
'common/debug.c',
'common/encode.c',
- 'common/error.c',
+ 'common/error/error.c',
'common/io/filter/buffer.c',
'common/io/filter/filter.c',
'common/io/filter/group.c',
diff --git a/test/code-count/file-type.yaml b/test/code-count/file-type.yaml
index ec40467a3..a779cbd58 100644
--- a/test/code-count/file-type.yaml
+++ b/test/code-count/file-type.yaml
@@ -863,19 +863,19 @@ src/common/encode.h:
class: core
type: c/h
-src/common/error.auto.c.inc:
+src/common/error/error.auto.c.inc:
class: core/auto
type: c
-src/common/error.auto.h:
+src/common/error/error.auto.h:
class: core/auto
type: c/h
-src/common/error.c:
+src/common/error/error.c:
class: core
type: c
-src/common/error.h:
+src/common/error/error.h:
class: core
type: c/h
diff --git a/test/define.yaml b/test/define.yaml
index 33ca48079..1b6d8908d 100644
--- a/test/define.yaml
+++ b/test/define.yaml
@@ -52,11 +52,11 @@ unit:
harness:
name: error
shim:
- common/error: ~
+ common/error/error: ~
coverage:
- - common/error
- - common/error.auto: noCode
+ - common/error/error
+ - common/error/error.auto: noCode
depend:
- common/stackTrace
diff --git a/test/src/common/harnessBackup.c b/test/src/common/harnessBackup.c
index 4592183a0..b3e3bb139 100644
--- a/test/src/common/harnessBackup.c
+++ b/test/src/common/harnessBackup.c
@@ -9,7 +9,6 @@ Harness for Creating Test Backups
#include "common/compress/helper.h"
#include "common/crypto/common.h"
#include "common/crypto/hash.h"
-#include "common/error.h"
#include "common/lock.h"
#include "config/config.h"
#include "info/infoArchive.h"
diff --git a/test/src/common/harnessError.h b/test/src/common/harnessError.h
index 229ef6e97..a7c2d8257 100644
--- a/test/src/common/harnessError.h
+++ b/test/src/common/harnessError.h
@@ -4,7 +4,7 @@ Harness for Loading Test Configurations
#ifndef TEST_COMMON_HARNESS_ERROR_H
#define TEST_COMMON_HARNESS_ERROR_H
-#include "common/error.h"
+#include "common/error/error.h"
#include "common/type/param.h"
/***********************************************************************************************************************************
diff --git a/test/src/common/harnessServer.c b/test/src/common/harnessServer.c
index ea9c32e69..1be1e2f8f 100644
--- a/test/src/common/harnessServer.c
+++ b/test/src/common/harnessServer.c
@@ -13,7 +13,6 @@ Server Test Harness
#include
#include "common/crypto/common.h"
-#include "common/error.h"
#include "common/io/socket/server.h"
#include "common/io/tls/server.h"
#include "common/io/tls/session.h"
diff --git a/test/src/common/harnessTest.h b/test/src/common/harnessTest.h
index 11c9adb5f..6f30db484 100644
--- a/test/src/common/harnessTest.h
+++ b/test/src/common/harnessTest.h
@@ -8,7 +8,6 @@ C Test Harness
#include "common/assert.h"
#include "common/debug.h"
-#include "common/error.h"
#include "common/harnessTest.intern.h"
diff --git a/test/src/main.c b/test/src/main.c
index a1245ac81..aea78f42c 100644
--- a/test/src/main.c
+++ b/test/src/main.c
@@ -10,7 +10,6 @@ Main
#include "command/help/help.h"
#include "command/test/test.h"
#include "common/debug.h"
-#include "common/error.h"
#include "common/log.h"
#include "common/macro.h"
#include "common/memContext.h"
diff --git a/test/src/module/build/errorTest.c b/test/src/module/build/errorTest.c
index 7f8b7e1c7..edc6fa4d6 100644
--- a/test/src/module/build/errorTest.c
+++ b/test/src/module/build/errorTest.c
@@ -57,14 +57,14 @@ testRun(void)
TEST_STORAGE_GET(
storageTest,
- "src/common/error.auto.h",
+ "src/common/error/error.auto.h",
COMMENT_BLOCK_BEGIN "\n"
"Error Type Definition\n"
"\n"
"Automatically generated by 'build-code error' -- do not modify directly.\n"
COMMENT_BLOCK_END "\n"
- "#ifndef COMMON_ERROR_AUTO_H\n"
- "#define COMMON_ERROR_AUTO_H\n"
+ "#ifndef COMMON_ERROR_ERROR_AUTO_H\n"
+ "#define COMMON_ERROR_ERROR_AUTO_H\n"
"\n"
COMMENT_BLOCK_BEGIN "\n"
"Error type declarations\n"
@@ -80,7 +80,7 @@ testRun(void)
TEST_STORAGE_GET(
storageTest,
- "src/common/error.auto.c.inc",
+ "src/common/error/error.auto.c.inc",
COMMENT_BLOCK_BEGIN "\n"
"Error Type Definition\n"
"\n"
diff --git a/test/src/module/command/exitTest.c b/test/src/module/command/exitTest.c
index a269d2702..3449ba8b1 100644
--- a/test/src/module/command/exitTest.c
+++ b/test/src/module/command/exitTest.c
@@ -1,7 +1,6 @@
/***********************************************************************************************************************************
Test Exit Routines
***********************************************************************************************************************************/
-#include "common/error.h"
#include "common/log.h"
#include "config/config.h"
#include "version.h"
diff --git a/test/src/module/test/testTest.c b/test/src/module/test/testTest.c
index c11aa2f11..29ba4fc99 100644
--- a/test/src/module/test/testTest.c
+++ b/test/src/module/test/testTest.c
@@ -122,7 +122,7 @@ testRun(void)
String *const harnessErrorC = strCat(
strNew(), strNewBuf(storageGetP(storageNewReadP(storageRepo, STRDEF("test/src/common/harnessError.c")))));
- strReplace(harnessErrorC, STRDEF("{[SHIM_MODULE]}"), STRDEF("#include \"" TEST_PATH "/repo/src/common/error.c\""));
+ strReplace(harnessErrorC, STRDEF("{[SHIM_MODULE]}"), STRDEF("#include \"" TEST_PATH "/repo/src/common/error/error.c\""));
// Unit test harness
// -------------------------------------------------------------------------------------------------------------------------
@@ -159,11 +159,11 @@ testRun(void)
" harness:\n"
" name: error\n"
" shim:\n"
- " common/error: ~\n"
+ " common/error/error: ~\n"
" coverage:\n"
- " - common/error\n"
- " - common/error.auto: noCode\n"
- " - common/error.inc: included\n"
+ " - common/error/error\n"
+ " - common/error/error.auto: noCode\n"
+ " - common/error/error.inc: included\n"
" depend:\n"
" - common/stackTrace\n"
" - common/type/stringStatic\n"
@@ -203,7 +203,7 @@ testRun(void)
" - test/common/shim\n"
" - test/common/shim2\n"
" include:\n"
- " - common/error\n"
+ " - common/error/error\n"
" - test/common/include\n"
"\n"
"integration:\n"
@@ -232,10 +232,10 @@ testRun(void)
"src/common/assert.h",
"src/common/debug.c",
"src/common/debug.h",
- "src/common/error.auto.c.inc",
- "src/common/error.auto.h",
- "src/common/error.c",
- "src/common/error.h",
+ "src/common/error/error.auto.c.inc",
+ "src/common/error/error.auto.h",
+ "src/common/error/error.c",
+ "src/common/error/error.h",
"src/common/logLevel.h",
"src/common/macro.h",
"src/common/stackTrace.c",
diff --git a/test/src/test.c b/test/src/test.c
index 63fae2332..5a4178a6b 100644
--- a/test/src/test.c
+++ b/test/src/test.c
@@ -33,7 +33,7 @@ The test code is included directly so it can freely interact with the included C
#include
#ifdef HRN_FEATURE_ERROR
- #include "common/error.h"
+ #include "common/error/error.h"
#include "common/macro.h"
#endif