From 83612a40c067cd9a72aff7c4ab0947f68b951119 Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Fri, 10 Oct 2025 11:13:33 -0400 Subject: [PATCH] m --- pkg/js/helpers.js | 11 +++++++++++ .../rtypes/cfsingleredirect/cfsingleredirect.go | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/js/helpers.js b/pkg/js/helpers.js index 4e317d983..d84eb6fa6 100644 --- a/pkg/js/helpers.js +++ b/pkg/js/helpers.js @@ -2238,6 +2238,16 @@ var DISABLE_REPEATED_DOMAIN_CHECK = { skip_fqdn_check: 'true' }; // Go. function rawrecordBuilder(type) { + + // Record which line called this record type. + // NB(tlim): Hopefully we can find a better way to do this in the + // future. Right now we're faking that there was an error just to parse + // out the line number. That's inefficient but I can't find anything better. + // This will certainly break if we change to a different Javascript interpreter. + // Hopefully any other interpreter will have a better way to do this. + var positionLines = new Error().stack.split('\n'); + var position = positionLines[positionLines.length - 2]; + return function () { // Copy the raw args: var rawArgs = []; @@ -2248,6 +2258,7 @@ function rawrecordBuilder(type) { return function (d) { var record = { type: type, + filepos: position, }; // Process the args: Functions are executed, objects are assumed to diff --git a/providers/cloudflare/rtypes/cfsingleredirect/cfsingleredirect.go b/providers/cloudflare/rtypes/cfsingleredirect/cfsingleredirect.go index 73f88b2e0..4047d0b1c 100644 --- a/providers/cloudflare/rtypes/cfsingleredirect/cfsingleredirect.go +++ b/providers/cloudflare/rtypes/cfsingleredirect/cfsingleredirect.go @@ -28,7 +28,9 @@ func FromRaw(rc *models.RecordConfig, items []any) error { name = items[0].(string) code = items[1].(uint16) if code != 301 && code != 302 && code != 303 && code != 307 && code != 308 { - return fmt.Errorf("code (%03d) is not 301,302,303,307,308", code) + return fmt.Errorf("%s: code (%03d) is not 301,302,303,307,308", rc.FilePos, code) + error: this is failing. + `( dnsc && go install ) && dns && time dnscontrol check` } when = items[2].(string) then = items[3].(string)