Comments (5)
My vote: std::runtime_exception all the way unless you need to catch and re throw somewhere specifically inside the library, then a custom exception could be through/caught and re throw for the user as a runtime exception. I think the type of exception is much less important that that all exceptions can be caught as std:exception and that they provide a helpful what().
from libosmium.
- All exceptions thrown derive from std::exception
- Where applicable exceptions should be or derive from std::runtime_error
- All osmium-specific exceptions are directly in
namespace osmium
- Osmium-specific exceptions should be used in cases where targeted
catch
clauses will probably be used - All exceptions need to be documented
- All functions throwing exceptions need to document which exceptions they throw
from libosmium.
All functions throwing exceptions need to document which exceptions they throw
Strictly speaking, it would be great to also document exception safety and guarantees we can give and also what we can not guarantee for. For example, where can we provide the strong exception safety guarantee, where is it not possible (or simply not implemented) and what happens in those cases.
This gives a great summary of what this means for the code.
The documentation currently lacks this, making it hard to reason about correctness for simple scenarios like: "what happens if my handler throws", and "what happens if my handler throws and there is a node cache handler in front of it" and "how is the interaction between handlers when one of them throws?" and more. Of course I can read the code and do some tests, but it would be great to document this.
from libosmium.
I agree. But it is a huge task and we have to keep the documentation in sync with the implementation. So more of a long-term project. :-)
from libosmium.
This has mostly been done now. If anybody finds cases where exceptions are not used in the right way, open individual issues for it.
from libosmium.
Related Issues (20)
- o5m parser issue HOT 2
- o5m parser issue, part 2 HOT 3
- Anychance to have a C interface ? HOT 1
- ctest failing on newly compiled code HOT 1
- Please reconsider the fadvise() usage HOT 3
- Increase maximimum integers in opl_parser_functions.hpp HOT 4
- Lots of warnings after #5d50405 in VS2019 HOT 5
- Unable to compile with c++20 when using precompiled binaries HOT 8
- Failing to compile libosmium: 'protozero/types.hpp' file not found HOT 5
- Incorrect proj usage HOT 1
- libosmium no longer successfully builds after `v2.17.1` on CentOS 7 HOT 2
- Need help, how to add altitude to libosmium HOT 2
- Missing prepare_for_lookup in test_members_database.cpp HOT 1
- heads-up: PROJ_LIB is now deprecated (use PROJ_DATA instead)
- io_test_bzip2 fails on Alpine Linux HOT 3
- AppVeyor builds fail due to missing LZ4 HOT 5
- Print offending string in PBF-Decoder
- installation make error HOT 2
- Does libosmium work with MacOS (M series chip)
- Performance Issues with `timegm` called from `parse_timestamp` on iOS 16.2 HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libosmium.