ARM way how to handle and generate own run time error, like try raise catch

Hello,

What is the most standard ARM way to handle run time errors on a Cortex M7? I have code in C and C++ and I like to generate and catch errors that I find in my code. The result will optionally be logged to a UART.  I like to make use of  the macros__FILE__, __LINE__ and put a custom_message.

An example would be input checking to a function, e.g. a function like convertToFahrenheight(float celsius) and raises a fault if somebody tries to pass -400 Celsius which can't exist. What is an ARM standard way to raise the exception?

I used ideas from this article (Exceptions in C with Longjmp and Setjmp) to implement try catch throw  on a C++ embedded system that did not have it implemented. I sew that MISRA C doesn't permit longjmp and setjmp, so I am looking for alternatives. Personally, I am not constrained to use MISRA C, but I still like to know what else is out there.

http://groups.di.unipi.it/~nids/docs/longjump_try_trow_catch.html

Thanks.

More questions in this forum