Skip to content

Standardize error handling with specific exit codes#247

Open
ayushman1210 wants to merge 14 commits intoPecanProject:masterfrom
ayushman1210:Inconsistency
Open

Standardize error handling with specific exit codes#247
ayushman1210 wants to merge 14 commits intoPecanProject:masterfrom
ayushman1210:Inconsistency

Conversation

@ayushman1210
Copy link
Contributor

Description:
Error handling uses inconsistent patterns:

  • Some functions use exit(1) (generic)
  • Some use exit(EXIT_CODE_*) (specific error codes)
  • Some log errors before exiting, some don't

Location: At various places in the codebase

Example from modelParams.c:

if (!okay) {
  exit(1);  // Line 69 - generic exit code
}

// vs.

logError("format unrecognized in climate file...\n");
exit(EXIT_CODE_INPUT_FILE_ERROR);  // Line 184 - specific code with message

Changes

Standardize on using specific exit codes with error messages:

if (!okay) {
  logError("Required parameters missing from parameter file\n");
  exit(EXIT_CODE_INPUT_FILE_ERROR);
}

@ayushman1210
Copy link
Contributor Author

Hi @dlebauer
just checking in to see if you’ve had a chance to look at this PR when you get a moment.
Happy to make any changes or answer questions.
Thanks!!

Copy link
Collaborator

@Alomir Alomir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for cleaning up the code! (One minor suggestion to change)

@ayushman1210
Copy link
Contributor Author

Hi @Alomir ,
I noticed that the GitHub Actions workflow for my PR is failing due to the Lychee link checker. The error is caused by the http://contributor-covenant.org link in CODE_OF_CONDUCT.md being temporarily unreachable, not by any code changes.
I can either update the link to use HTTPS or add a Lychee exclusion for it so the workflow passes.
Would you like me to make that fix, or should we ignore the Lychee check for this PR?

@ayushman1210 ayushman1210 requested a review from Alomir February 3, 2026 17:00
@Alomir
Copy link
Collaborator

Alomir commented Feb 3, 2026

Also, the sipnet.out files should not be deleted

@ayushman1210 ayushman1210 requested a review from Alomir February 3, 2026 17:50
Copy link
Collaborator

@Alomir Alomir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the change to .gitignore in #253; please remove that file from this PR, and you'll be good to go!

@ayushman1210 ayushman1210 requested a review from Alomir February 7, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants