Introduce (optional) exeception handling #343

Open
opened 2021-01-12 12:48:19 +01:00 by muellerr · 0 comments
Owner

According to this post https://stackoverflow.com/questions/5257190/are-exceptions-still-undesirable-in-realtime-environment and some research on the internet / watching videos by C++ experts, exceptions can be a useful tool for error handling. I think it would be a good idea to add (optional) exception support. A first way to check whether this is
feasible would be to monitor the code size. My guess is that the increase will be negligible
and on systems like a Q7S, the code size does not matter anyway.

I think one useful place to use it would be catching std::bad_alloc exceptions. Nobody checks the resulting pointer of a new operation in the factory and it would be too much of a hassle anyway. Exceptions are a very convenient way to handle issues which are configuration errors or just "should not happen" and I found them extremely useful and superior to returncodes in Python.

Another useful example would be to throw std::invalid_argument https://en.cppreference.com/w/cpp/error/invalid_argument if there are issues at initializatin time, which would allow developers to move initialization code to the constructor and catch configuration errors via exception.

According to this post https://stackoverflow.com/questions/5257190/are-exceptions-still-undesirable-in-realtime-environment and some research on the internet / watching videos by C++ experts, exceptions can be a useful tool for error handling. I think it would be a good idea to add (optional) exception support. A first way to check whether this is feasible would be to monitor the code size. My guess is that the increase will be negligible and on systems like a Q7S, the code size does not matter anyway. I think one useful place to use it would be catching `std::bad_alloc` exceptions. Nobody checks the resulting pointer of a `new` operation in the factory and it would be too much of a hassle anyway. Exceptions are a very convenient way to handle issues which are configuration errors or just "should not happen" and I found them extremely useful and superior to returncodes in Python. Another useful example would be to throw `std::invalid_argument` https://en.cppreference.com/w/cpp/error/invalid_argument if there are issues at initializatin time, which would allow developers to move initialization code to the constructor and catch configuration errors via exception.
muellerr added the
feature
label 2021-01-12 12:48:19 +01:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: fsfw/fsfw#343
No description provided.