In a function you could get an error cause by APL or by .Net, how do you differenciate between the 2 when you want to report the error by using :Trap 0 for exemple ? If you do ⎕EXCEPTION.Message when its empty you get a VALUE ERROR and ⎕DM may not be empty when the error comes from .Net because of a previous error.
Thanks,
Pierre Gilbert
How to trap the last error Message
-
- Posts: 431
- Joined: Fri Oct 03, 2008 4:14 pm
Re: How to trap the last error Message
I think []EN should be 90 after a .NET error, and something else otherwise, which should to the trick, unless I am missing something, which I probably am.
Re: How to trap the last error Message
Thanks Paul, here is what works for me. If someone has made something more complete and would like to share...
Pierre Gilbert
Code: Select all
r←GetLastError
⍝ Return the Last Error
:If 90=⎕EN
r←'EXCEPTION: ',⎕EXCEPTION.Message
:Else
r←(1⊃⎕DM),': ',{(~(∧\' '=⍵)∨(⌽∧\⌽' '=⍵))/⍵}(2⊃⎕DM)
:EndIf
Pierre Gilbert