SAP / styleguides

This repository provides SAP style guides for coding and coding-related topics.
Other
1.68k stars 444 forks source link

Abap Exception categories #335

Closed niuniuch closed 1 year ago

niuniuch commented 1 year ago

It's 2023 and it's time to rewrite the section on exception categories (or remove it completely if you think it's not a settled subject) because in it's current state is causing harm.

Robert Martin said it already in 2001, and in 2023 it's clear as dailight.

  1. Use CX_NO_CHECK.
  2. In exceptional cases, when you want customers of your software to acknowledge exceptions that it might throw, consider wrapping a CX_CHECK exception around them in your public API layer (for example when developing a code library for sale).
  3. Never use CX_DYNAMIC_CHECK, as it's just an checked exception that can't be caught by it's name, it's always better to just use CX_NO_CHECK
ConjuringCoffee commented 1 year ago

There's already a discussion about the same topic from 2020 that's unfortunately still open: #138

I suggest you either add a comment to that discussion or open a pull request to facilitate a faster discussion? 😉

niuniuch commented 1 year ago

Thanks for pointing that out, I added a comment in #138. I guess what is an exceptional case for me, might be the usual case for others. It all depends on what kind of code you're working on...

bjoern-jueliger-sap commented 1 year ago

Closing this since the main discussion is in #138