Skip to content

Standardize error handling with specific exit codes#247

Merged
Alomir merged 17 commits into
PecanProject:masterfrom
ayushman1210:Inconsistency
Feb 12, 2026
Merged

Standardize error handling with specific exit codes#247
Alomir merged 17 commits into
PecanProject:masterfrom
ayushman1210:Inconsistency

Conversation

@ayushman1210

Copy link
Copy Markdown
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
Copy Markdown
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!!

@Alomir Alomir left a comment

Copy link
Copy Markdown
Collaborator

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)

Comment thread src/sipnet/events.c Outdated
@ayushman1210

Copy link
Copy Markdown
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
Comment thread .gitignore Outdated
@Alomir

Alomir commented Feb 3, 2026

Copy link
Copy Markdown
Collaborator

Also, the sipnet.out files should not be deleted

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

@Alomir Alomir left a comment

Copy link
Copy Markdown
Collaborator

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
@Alomir

Alomir commented Feb 9, 2026

Copy link
Copy Markdown
Collaborator

@ayushman - you didn't remove .gitignore from this PR, you submitted a deletion of the file itself. Please fix.

@ayushman1210

Copy link
Copy Markdown
Contributor Author

hi @Alomir i have restored the .gitignore file is there anything else i needed to update ?

@Alomir Alomir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks great, thanks for the work!

@Alomir Alomir merged commit 9bd7cce into PecanProject:master Feb 12, 2026
12 checks passed
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