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

N A asteriskteam at digium.com
Mon Oct 25 17:09:11 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: 
> Okay I'll concede it can be used in such a manner, and in that sense would be similar to a general p […]
The d option was sort of for the edge cases where, conceivably, someone would want to use this without ending the call. I figured it's better to be flexible, but the goal is to end the call in most cases. The test suite came to mind for the d option, but I think there are other requirements for that beyond the scope of Assert (e.g. AMI events).

I didn't anticipate disabling the Assert once code is set for production, at least personally, so I'm not sure what's meant by this. Part of the goal is to help catch aggression and continue to enforce those expectations, so I'm envisioning these being put in and left in, where something should always be true, and if it isn't, then something's gone wrong. I guess in theory a compiler option could be added like ENFORCE_ASSERTS and then Assert() would only do something if that were true, but I'm not sure if people would find that useful.

Even with the d option, it would basically be a Log + Hangup, and there's no way to log this information from the dialplan so it's not quite the same.

ErrorIf could be misleading, since this app isn't really designed for error handling. It really is almost like calling the assert() C function, except the goal is not to crash Asterisk but to crash the call. The error log is merely a side effect of that, and this isn't an Error() application. So that's why I think Assert best captures what this aims to do.



-- 
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 22:09:11 +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/231b0585/attachment-0001.html>


More information about the asterisk-code-review mailing list