Hello again,

You're right Nicolas, that is better than silent failures but I did a
quick test and did get an error like this:
> Uncaught exception - glue@watch_dir
> Failed to load module !

And that is a bit cryptic, I'd say. So I tried to write my own macro:
#define val_match_or_fail(v,t) if( !val_is_##t(v) ) { \
   char _temp_[256]; \
   snprintf( _temp_, 256, "Excepted " #t " in %s (%d).", __FILE__, __LINE__ ); \
   failure(_temp_); \
 }

Which gives an error like:
Uncaught exception - watch.c(38) : Excepted string in watch.c (38).

which is a bit more explaining.

Med vänliga hälsningar / best regards
→ Frank M. Eriksson ( http://knarf.se/ )
Office / Kontorsnr :(+46)18 - 490 24 42



2011/1/19 Nicolas Cannasse <[email protected]>:
> Le 19/01/2011 13:00, Frank Eriksson a écrit :
>>
>> Hello Robin and nekolist,
>> Thankyou Robin for your reply, It made me realize that I'd missed
>> something:
>>        neko.Lib.haxeToNeko( )
>>
>> In the ndll that I had made I had this little snippet of code:
>>        if( !val_is_string( directory ) ){
>>                return val_null;
>>        }
>
> You can use val_check(directory,string) that will return NULL if the check
> fail and produce an "Invalid Call" exception (which is better than a silent
> failure).
>
> Best,
> Nicolas
>

--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to