Browse Source

Fix: setEmitDiagnosticNotices was called too late

* config file errors were not emitted because setEmitDiagnosticNotices
  was not called until the end of config file validation
Rod Hynes 10 years ago
parent
commit
276407f027
1 changed files with 5 additions and 4 deletions
  1. 5 4
      psiphon/config.go

+ 5 - 4
psiphon/config.go

@@ -320,6 +320,11 @@ func LoadConfig(configJson []byte) (*Config, error) {
 		return nil, ContextError(err)
 	}
 
+	// Do setEmitDiagnosticNotices first, to ensure config file errors are emitted.
+	if config.EmitDiagnosticNotices {
+		setEmitDiagnosticNotices(true)
+	}
+
 	// These fields are required; the rest are optional
 	if config.PropagationChannelId == "" {
 		return nil, ContextError(
@@ -389,9 +394,5 @@ func LoadConfig(configJson []byte) (*Config, error) {
 			"UpgradeDownloadUrl requires UpgradeDownloadClientVersionHeader and UpgradeDownloadFilename"))
 	}
 
-	if config.EmitDiagnosticNotices {
-		setEmitDiagnosticNotices(true)
-	}
-
 	return &config, nil
 }