From 64a6a0d5057d56d3337f28894e433186b7296928 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Mon, 24 Mar 2025 14:36:11 -0700
Subject: [PATCH] Add more detail to the file open failure exception

---
 exec/load/recordfile.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exec/load/recordfile.js b/exec/load/recordfile.js
index 663d99e27b..85754855ac 100644
--- a/exec/load/recordfile.js
+++ b/exec/load/recordfile.js
@@ -71,7 +71,7 @@ function RecordFile(filename, definition)
 	this.RecordLength=getRecordLength(this.fields);
 	// A vbuf of a record length prevents more than one record from being in the buffer.
 	if(!this.file.open(file_exists(this.file.name)?"rb+":"wb+",true,this.RecordLength)) {
-		throw new Error("Failed to open file "+this.file.name);
+		throw new Error(format("%d (%s) opening '%s'", this.file.error, strerror(this.file.error), this.file.name));
 	}
 	Object.defineProperty(this, 'length', {
 		enumerable: true,
-- 
GitLab