[m-users.] Converting an exception to a different exception

Volker Wysk post at volker-wysk.de
Thu May 20 15:39:30 AEST 2021


Hi

I want do convert an exception from one type to another. Like this:


:- pred dir_to_name(pages::in, string::in, string::out) is det. 

dir_to_name({ _, DirNameM }, Dir, Name) :-
    ( try []                                                     
          map.lookup(DirNameM, Dir, Name)
      then  
          true
      catch software_error(_) ->
          throw("Unknown page directory " ++ quote(Dir))
    ).


This won't compile, because "A try goal has determinism cc_multi." (Mercury
Reference Manual, chapter 12).

Is there any way to do this?

Regards,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20210520/f95713dc/attachment.sig>


More information about the users mailing list