helper functions for Filesystem error handling#1015
Merged
Conversation
Contributor
|
Thanks for this PR @wassup05. Question: is there a reason for using UPPER_CASE ? The style guide promotes snake_case for procedures and constants. |
Contributor
Author
|
Oh no, It was just because it was an error and I felt it was better to emphasize that, but I'll change it |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces two helper functions fs_error and fs_error_code to simplify filesystem error handling in the stdlib_system module. These functions provide convenient ways to create state_type objects with the STDLIB_FS_ERROR flag set.
- Adds
fs_errorfunction that accepts up to 20 optional arguments and creates a filesystem error state - Adds
fs_error_codefunction that prefixes an error code to the message and accepts up to 19 additional arguments - Includes comprehensive tests, documentation, and example code
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/stdlib_system.F90 |
Implements the two new helper functions and adds required imports |
test/system/test_filesystem.f90 |
Adds unit tests for both helper functions |
doc/specs/stdlib_system.md |
Documents the new functions with detailed specifications |
example/system/example_fs_error.f90 |
Provides usage examples for both functions |
example/system/CMakeLists.txt |
Registers the new example in the build system |
Comments suppressed due to low confidence (2)
test/system/test_filesystem.f90:25
- The subroutine name
test_fs_erroris inconsistent with the test nametest_FS_ERRORused innew_unittest. Consider renaming totest_FS_ERRORfor consistency.
subroutine test_fs_error(error)
doc/specs/stdlib_system.md:472
- The syntax example shows
fs_errorbut should befs_error_codesince this is documenting thefs_error_codefunction.
`err = fs_error(code [, a1,a2,a3,a4...... a19])`
jalvesz
approved these changes
Jul 19, 2025
perazz
reviewed
Jul 19, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 22, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 22, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 22, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 22, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 22, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 22, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 22, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 22, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 22, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 22, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 23, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 23, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 23, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 23, 2025
github-actions Bot
added a commit
to banana-bred/stdlib
that referenced
this pull request
Jul 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Functions added are:
fs_error: just sets theflagofstate_typetoSTDLIB_FS_ERRORand passes the remaining 20 arguments to itfs_error_code: sets theflagas above and also prefixes thecode(integerargument) accordingly.I tried using an
interfaceblock to handle both of these together, but that introduces ambiguity for the compiler.Could make
codeanoptionalargument and depending on if it's present or not pass 18 or 20 arguments tostate_typebut I feel that the 2 unused arguments in that case would not be correct.Inspired from @perazz in #1006 (comment)