Miscellaneous-NoCatchAll

You should not use catch(…)

Required inputs: IR

Do not use a catch(...) unless you re-throw the exception.

Possible Messages

Key

Text

Severity

Disabled

catch_all

Use of catch(…).

None

False

catch_std_exception

Catching std::exceptions is too general.

None

False

Options

allow_in_extern_c_functions

allow_in_extern_c_functions : bool = False

Whether to allow a catch-all in extern C functions.
 

allow_in_functions_matching

allow_in_functions_matching : typing.Pattern[str] | None = None

If not None, a re.compile()ed object where functions whose qualified name matches the regex are allowed to contain catch-alls.
 

allow_in_main

allow_in_main : bool = False

Whether to allow a catch-all in the main() function.
 

allow_in_thread_main

allow_in_thread_main : bool = False

Whether to allow a catch-all in thread-main functions.
 

allow_rethrow

allow_rethrow : bool = True

Whether to allow a catch-all with a re-throw.
 

autosar_exception_model

autosar_exception_model

Type: bauhaus.ir.autosar.exceptions.autosar_exceptions.AutosarExceptionModel

Default: <bauhaus.ir.autosar.exceptions.autosar_exceptions.AutosarExceptionModel object at 0x7f6f1d938d90>

The default model for what counts as an checked / unchecked exception.
 

disallow_std_exception

disallow_std_exception : bool = False

Whether to consider catching the literal std::exception as a catch-all.