no function clause matching became no case clause matching exception

Michael P. empro2@REDACTED
Mon Dec 13 15:22:18 CET 2021


:-)

On Fri, 10 Dec 2021 16:30:23 +0100
Frans Schneider <fchschneider@REDACTED> wrote:

> The construct is used to process a list which should contain a mixture
> of #o{} and #oa{} records. If the list contains other types of records
> --which should never be the case--, it must fail. This is the actual code:
>
>      ATE_ids = [(fun(#oa{id = AT_id}) -> AT_id;
>                     (#o{id = AT_id}) -> AT_id end)(AT) || AT <- ATEs],

So far, to me "fail" means 'process dies' and 'no catching'.
When "function" or "case" in the exception matters, is there some `catch`?

    ATE_ids = [(fun (#oa{id = AT_id}) -> AT_id;
                    (#o{id = AT_id}) -> AT_id;
                    (Except) -> throw({myapp_unok, Except}) end)(AT)
               || AT <- ATEs],

If you can name it, you can claim it?

:-)

~Michael

--

The oldest, largest, most buggy piece of legacy
software in constant maintenance: human society.






More information about the erlang-questions mailing list