diff --git a/src/config/Param.cxx b/src/config/Param.cxx
index e27059d70..97e600b44 100644
--- a/src/config/Param.cxx
+++ b/src/config/Param.cxx
@@ -24,13 +24,19 @@
 
 #include <stdexcept>
 
+void
+ConfigParam::ThrowWithNested() const
+{
+	std::throw_with_nested(FormatRuntimeError("Error on line %i", line));
+}
+
 AllocatedPath
 ConfigParam::GetPath() const
 {
 	try {
 		return ParsePath(value.c_str());
 	} catch (...) {
-		std::throw_with_nested(FormatRuntimeError("Invalid path at line %i: ", line));
+		ThrowWithNested();
 	}
 
 }
diff --git a/src/config/Param.hxx b/src/config/Param.hxx
index 9162ec4c6..05ca8cd04 100644
--- a/src/config/Param.hxx
+++ b/src/config/Param.hxx
@@ -58,6 +58,14 @@ struct ConfigParam {
 	 * Throws #std::runtime_error on error.
 	 */
 	AllocatedPath GetPath() const;
+
+	/**
+	 * Call this method in a "catch" block to throw a nested
+	 * exception showing the location of this setting in the
+	 * configuration file.
+	 */
+	[[noreturn]]
+	void ThrowWithNested() const;
 };
 
 #endif