postscript Error Handling Signalling (throwing) an error


Most of the tools are standardized with the exception of the name of the operator to throw an error. In Adobe interpreters, it is called .error. In ghostscript, it is called signalerror. So with this line you can use signalerror in postscript code for Adobe interpreters or ghostscript or xpost.

/.error where {pop /signalerror /.error load def} if

commandname errorname     signalerror     —
Take snapshots of the stack in $error, then stop.


% my proc only accepts integer
/proc {
    dup type /integertype ne {
        /proc cvx /typecheck signalerror
    } if
    % ... rest of proc ...
} def