[Asterisk-code-review] app_assert: Add Assert application (asterisk[master])

N A asteriskteam at digium.com
Mon Oct 25 18:27:33 CDT 2021


Attention is currently required from: Kevin Harwell.
N A has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/16629 )

Change subject: app_assert: Add Assert application
......................................................................


Patch Set 2:

(1 comment)

Patchset:

PS2: 
> I guess one person's error handling is another's assert :-) […]
Well, it also logs the condition itself, which isn't something that can be manually done in dialplan.

Apart from the bonus d option, I feel like it's unequivocally an assert(), as close as it could be ported from C to dialplan. A compiler flag could also be added for enabling/disabling asserts to address the other concern.

If we take a different language like Java, which has both the try/catch concept as well as Throw new Exception, RaiseException is closer to that than Assert as well.

Fundamentally, the main difference I see is that RaiseException is intended for error handling, and expects that an e extension is defined so we execute code there. Assert does not allow error handling, if it is false, that is the last thing that will ever execute for the call. That's really the main goal. Error handling is for things that could go wrong, Assert is for things that should never go wrong, and if they do, it's bad enough we should just give up.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16629
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ia089c2debf608f42f5f87e6c29d50e8ebcc093e5
Gerrit-Change-Number: 16629
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-CC: Joshua Colp <jcolp at sangoma.com>
Gerrit-CC: Kevin Harwell <kharwell at digium.com>
Gerrit-Attention: Kevin Harwell <kharwell at digium.com>
Gerrit-Comment-Date: Mon, 25 Oct 2021 23:27:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: N A <mail at interlinked.x10host.com>
Comment-In-Reply-To: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211025/9c9f520b/attachment.html>


More information about the asterisk-code-review mailing list