Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always check if path exists #357

Open
elshize opened this issue Apr 6, 2020 · 1 comment
Open

Always check if path exists #357

elshize opened this issue Apr 6, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request refactoring

Comments

@elshize
Copy link
Member

elshize commented Apr 6, 2020

We have many places where we just assume that a file exists, say, when we create a mio::mmap_source, which then fails with simply No such file exists or something similar if the file is missing. It's difficult to debug, and more importantly, it's very confusing to the end user. We should at least have a function resolve_path(str) that throws a more informative error message. We can also think of having another function resolve_path(path, msgfmt, args...) that would use fmt to display message, and some specialized functions that repeat many times, say:

auto resolve_term_lexicon_path(std::string_view path) {
    return resolve_path(path, "Missing term lexicon file: {}", path);
}

But I'm also open to other suggestions.

@JMMackenzie
Copy link
Member

+1, sounds like a nice idea.

@elshize elshize self-assigned this Sep 8, 2022
@elshize elshize added enhancement New feature or request refactoring labels Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring
Projects
None yet
Development

No branches or pull requests

2 participants