[gambit-list] Improving error reporting

Marc Feeley feeley at iro.umontreal.ca
Tue Feb 3 17:26:39 EST 2015


Yes.  That’s handled when you link with the universal library (in fact the current univ-lib will raise an exception in that case).  But if this is all you want to handle, just write your code like this:

  (define (##apply-global-with-procedure-check-nary gv . args)
    (declare (standard-bindings))
    (println (list "*** ERROR -- call to unbound global variable " gv))
    (0)) ;; really crash!

  (foo 1 2 3)

The generated JS code calls the ##apply-global-with-procedure-check-nary function when a non-procedure bound to a global variable is called.

Marc

> On Feb 3, 2015, at 4:51 PM, Blake McBride <blake at mcbride.name> wrote:
> 
> Greetings,
> 
> When running a JS target, if an unknown function is called, would it be possible to say something like:
> 
> Error: call to unknown function XYZ
> 
> Rather than:
> 
> /home/blake/z/gambit/fib.js:348
>     pc = pc();
>          ^
> TypeError: undefined is not a function
>     at gambit_trampoline (/home/blake/z/gambit/fib.js:348:10)
>     ......
> 
> 
> Thanks.
> 
> Blake McBride
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4839 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150203/7034c5df/attachment.bin>


More information about the Gambit-list mailing list