[PR #95] [CLOSED] Added supplementary error checking #287

Closed
opened 2026-03-13 16:15:45 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/acme-dns/acme-dns/pull/95
Author: @sh511
Created: 7/14/2018
Status: Closed

Base: masterHead: err-handling-suppl


📝 Commits (4)

  • 603f092 Added supplementary errorichecking
  • 9ce7cc7 After running util.go through gofmt
  • 3408a0b Updated main and util
  • df3c730 Minor updates to main and util

📊 Changes

2 files changed (+27 additions, -5 deletions)

View changed files

📝 main.go (+7 -4)
📝 util.go (+20 -1)

📄 Description

Added some additional error checking:

  1. In util.go, checking for errors in the tom.DecodeFile call (func ReadConfig). DecodeFile itself may rarely return an error but will if the config.cfg file has errors, e.g. missing quotes. If errors are not checked at this point, readConfig returns an invalid configuration that will generate an error in main.go showing up as an empty driver since the Config.Database.Engine string will be empty which is misleading as the cause of the problem.
  2. Modified fileExists in util.go to ensure that the file can be read and not only exists. The file may "exist" but have the wrong permissions. There might be a more elegant way than using Open.
  3. Added more explicit checks for the existence of the configuration file in main.go

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/acme-dns/acme-dns/pull/95 **Author:** [@sh511](https://github.com/sh511) **Created:** 7/14/2018 **Status:** ❌ Closed **Base:** `master` ← **Head:** `err-handling-suppl` --- ### 📝 Commits (4) - [`603f092`](https://github.com/acme-dns/acme-dns/commit/603f0921d5b46eeb61e1ed3d59743f35a4a28ca7) Added supplementary errorichecking - [`9ce7cc7`](https://github.com/acme-dns/acme-dns/commit/9ce7cc7122687e4a0d29f2566874497f06d4096d) After running util.go through gofmt - [`3408a0b`](https://github.com/acme-dns/acme-dns/commit/3408a0b47bed2880f96620acea8e02f9c0898b0e) Updated main and util - [`df3c730`](https://github.com/acme-dns/acme-dns/commit/df3c730c772398d6a4070d84c0fa810980e59eb0) Minor updates to main and util ### 📊 Changes **2 files changed** (+27 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `main.go` (+7 -4) 📝 `util.go` (+20 -1) </details> ### 📄 Description Added some additional error checking: 1) In util.go, checking for errors in the tom.DecodeFile call (func ReadConfig). DecodeFile itself may rarely return an error but will if the config.cfg file has errors, e.g. missing quotes. If errors are not checked at this point, readConfig returns an invalid configuration that will generate an error in main.go showing up as an empty driver since the Config.Database.Engine string will be empty which is misleading as the cause of the problem. 2) Modified fileExists in util.go to ensure that the file can be read and not only exists. The file may "exist" but have the wrong permissions. There might be a more elegant way than using Open. 3) Added more explicit checks for the existence of the configuration file in main.go --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 16:15:45 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/acme-dns#287
No description provided.