DX Unified Infrastructure Management

  • 1.  LUA Error Codes

    Posted Aug 17, 2012 04:00 PM

    Posted in a support case from one of the developers, useful information to share I thought.


    NIME_OK 0 /* OK */
    NIME_ERROR 1 /* error */
    NIME_COMERR 2 /* communication error */
    NIME_INVAL 3 /* invalid argument */
    NIME_NOENT 4 /* not found */
    NIME_ISENT 5 /* already defined */
    NIME_ACCESS 6 /* permission denied */
    NIME_AGAIN 7 /* temporarily out of resources */
    NIME_NOMEM 8 /* out of resources */
    NIME_NOSPC 9 /* no space left */
    NIME_EPIPE 10 /* broken connection */
    NIME_NOCMD 11 /* command not found */
    NIME_LOGIN 12 /* login failed */
    NIME_SIDEXP 13 /* SID expired */
    NIME_ILLMAC 14 /* illegal MAC */
    NIME_ILLSID 15 /* illegal SID */
    NIME_SIDSESS 16 /* Session id for hub is invalid */
    NIME_EXPIRED 17 /* Expired */
    NIME_NOLIC 18 /* No valid license */
    NIME_INVLIC 19 /* Invalid license */
    NIME_ILLLIC 20 /* Illegal license */
    NIME_INVOP 21 /* Invalid operation finv */
    NIME_USER 100 /* user error from this value and up */



  • 2.  Re: LUA Error Codes

    Posted Aug 24, 2012 02:00 PM

    As a function, just call codes(rc) when issuing somthing like:

     

    response,rc = nimbus.request(address, command, arguments)

     

    ----

     

    function codes(a)
    codes = {[0]="OK",[1]="error",[2]="communication error",[3]="invalid argument",[4]="not found",[5]="already defined",
    [6]="permission denied",[7]="temporarily out of resources",[8]="out of resources",[9]="no space left",[10]="broken connection",
    [11]="command not found",[12]="login failed",[13]="SID expired",[14]="illegal MAC",[15]="illegal SID",[16]="Session id for hub is invalid",
    [17]="Expired",[18]="No valid license",[19]="Invalid license",[20]="Illegal license",[21]="Invalid operation finv",[100]="user error from this value and up"}
    if rc == 0 then
    print(codes[rc])
    else if rc > 0 then
    print(codes[rc])
    end
    end
    end



  • 3.  Re: LUA Error Codes

    Posted Aug 24, 2012 05:16 PM

    Cool! I always end up looking up from this list of error codes manually and have thought for a long time that it would be nice if one of the Nimsoft-specific function libraries included these transations.



  • 4.  Re: LUA Error Codes

    Posted Aug 24, 2012 05:24 PM

    Having recently learned how to include lua files into my scripts I am thinking that (over time) to create one LUA file that holds various functions like this, and robins tdumper function he posted that can be included into a development script to help writing but might not be required at run time.

     

    copy this file to the nas scrips folder and do:

     

    dofile "scripts/dev_functions.lua"

     

    Any ideas for additional functions welcome....