include/ktap_errmsg.h - ktap

Macros defined

Source code

  1. /*
  2. * VM error messages.
  3. * Copyright (C) 2012-2014 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
  4. * Copyright (C) 2005-2014 Mike Pall.
  5. */

  6. /* Basic error handling. */
  7. ERRDEF(ERRMEM,    "not enough memory")
  8. ERRDEF(ERRERR,    "error in error handling")

  9. /* Allocations. */
  10. ERRDEF(STROV,    "string length overflow")
  11. ERRDEF(UDATAOV,    "userdata length overflow")
  12. ERRDEF(STKOV,    "stack overflow")
  13. ERRDEF(STKOVM,    "stack overflow (%s)")
  14. ERRDEF(TABOV,    "table overflow")

  15. /* Table indexing. */
  16. ERRDEF(NANIDX,    "table index is NaN")
  17. ERRDEF(NILIDX,    "table index is nil")
  18. ERRDEF(NEXTIDX,    "invalid key to " KTAP_QL("next"))

  19. /* Metamethod resolving. */
  20. ERRDEF(BADCALL,    "attempt to call a %s value")
  21. ERRDEF(BADOPRT,    "attempt to %s %s " KTAP_QS " (a %s value)")
  22. ERRDEF(BADOPRV,    "attempt to %s a %s value")
  23. ERRDEF(BADCMPT,    "attempt to compare %s with %s")
  24. ERRDEF(BADCMPV,    "attempt to compare two %s values")
  25. ERRDEF(GETLOOP,    "loop in gettable")
  26. ERRDEF(SETLOOP,    "loop in settable")
  27. ERRDEF(OPCALL,    "call")
  28. ERRDEF(OPINDEX,    "index")
  29. ERRDEF(OPARITH,    "perform arithmetic on")
  30. ERRDEF(OPCAT,    "concatenate")
  31. ERRDEF(OPLEN,    "get length of")

  32. /* Type checks. */
  33. ERRDEF(BADSELF,    "calling " KTAP_QS " on bad self (%s)")
  34. ERRDEF(BADARG,    "bad argument #%d to " KTAP_QS " (%s)")
  35. ERRDEF(BADTYPE,    "%s expected, got %s")
  36. ERRDEF(BADVAL,    "invalid value")
  37. ERRDEF(NOVAL,    "value expected")
  38. ERRDEF(NOCORO,    "coroutine expected")
  39. ERRDEF(NOTABN,    "nil or table expected")
  40. ERRDEF(NOLFUNC,    "ktap function expected")
  41. ERRDEF(NOFUNCL,    "function or level expected")
  42. ERRDEF(NOSFT,    "string/function/table expected")
  43. ERRDEF(NOPROXY,    "boolean or proxy expected")
  44. ERRDEF(FORINIT,    KTAP_QL("for") " initial value must be a number")
  45. ERRDEF(FORLIM,    KTAP_QL("for") " limit must be a number")
  46. ERRDEF(FORSTEP,    KTAP_QL("for") " step must be a number")

  47. /* C API checks. */
  48. ERRDEF(NOENV,    "no calling environment")
  49. ERRDEF(CYIELD,    "attempt to yield across C-call boundary")
  50. ERRDEF(BADLU,    "bad light userdata pointer")

  51. /* Standard library function errors. */
  52. ERRDEF(ASSERT,    "assertion failed!")
  53. ERRDEF(PROTMT,    "cannot change a protected metatable")
  54. ERRDEF(UNPACK,    "too many results to unpack")
  55. ERRDEF(RDRSTR,    "reader function must return a string")
  56. ERRDEF(PRTOSTR,    KTAP_QL("tostring") " must return a string to " KTAP_QL("print"))
  57. ERRDEF(IDXRNG,    "index out of range")
  58. ERRDEF(BASERNG,    "base out of range")
  59. ERRDEF(LVLRNG,    "level out of range")
  60. ERRDEF(INVLVL,    "invalid level")
  61. ERRDEF(INVOPT,    "invalid option")
  62. ERRDEF(INVOPTM,    "invalid option " KTAP_QS)
  63. ERRDEF(INVFMT,    "invalid format")
  64. ERRDEF(SETFENV,    KTAP_QL("setfenv") " cannot change environment of given object")
  65. ERRDEF(CORUN,    "cannot resume running coroutine")
  66. ERRDEF(CODEAD,    "cannot resume dead coroutine")
  67. ERRDEF(COSUSP,    "cannot resume non-suspended coroutine")
  68. ERRDEF(TABINS,    "wrong number of arguments to " KTAP_QL("insert"))
  69. ERRDEF(TABCAT,    "invalid value (%s) at index %d in table for " KTAP_QL("concat"))
  70. ERRDEF(TABSORT,    "invalid order function for sorting")
  71. ERRDEF(IOCLFL,    "attempt to use a closed file")
  72. ERRDEF(IOSTDCL,    "standard file is closed")
  73. ERRDEF(OSUNIQF,    "unable to generate a unique filename")
  74. ERRDEF(OSDATEF,    "field " KTAP_QS " missing in date table")
  75. ERRDEF(STRDUMP,    "unable to dump given function")
  76. ERRDEF(STRSLC,    "string slice too long")
  77. ERRDEF(STRPATB,    "missing " KTAP_QL("[") " after " KTAP_QL("%f") " in pattern")
  78. ERRDEF(STRPATC,    "invalid pattern capture")
  79. ERRDEF(STRPATE,    "malformed pattern (ends with " KTAP_QL("%") ")")
  80. ERRDEF(STRPATM,    "malformed pattern (missing " KTAP_QL("]") ")")
  81. ERRDEF(STRPATU,    "unbalanced pattern")
  82. ERRDEF(STRPATX,    "pattern too complex")
  83. ERRDEF(STRCAPI,    "invalid capture index")
  84. ERRDEF(STRCAPN,    "too many captures")
  85. ERRDEF(STRCAPU,    "unfinished capture")
  86. ERRDEF(STRFMT,    "invalid option " KTAP_QS " to " KTAP_QL("format"))
  87. ERRDEF(STRGSRV,    "invalid replacement value (a %s)")
  88. ERRDEF(BADMODN,    "name conflict for module " KTAP_QS)
  89. ERRDEF(JITOPT,    "unknown or malformed optimization flag " KTAP_QS)

  90. /* Lexer/parser errors. */
  91. ERRDEF(XMODE,    "attempt to load chunk with wrong mode")
  92. ERRDEF(XNEAR,    "%s near " KTAP_QS)
  93. ERRDEF(XLINES,    "chunk has too many lines")
  94. ERRDEF(XLEVELS,    "chunk has too many syntax levels")
  95. ERRDEF(XNUMBER,    "malformed number")
  96. ERRDEF(XLSTR,    "unfinished long string")
  97. ERRDEF(XLCOM,    "unfinished long comment")
  98. ERRDEF(XSTR,    "unfinished string")
  99. ERRDEF(XESC,    "invalid escape sequence")
  100. ERRDEF(XLDELIM,    "invalid long string delimiter")
  101. ERRDEF(XTOKEN,    KTAP_QS " expected")
  102. ERRDEF(XJUMP,    "control structure too long")
  103. ERRDEF(XSLOTS,    "function or expression too complex")
  104. ERRDEF(XLIMC,    "chunk has more than %d local variables")
  105. ERRDEF(XLIMM,    "main function has more than %d %s")
  106. ERRDEF(XLIMF,    "function at line %d has more than %d %s")
  107. ERRDEF(XMATCH,    KTAP_QS " expected (to close " KTAP_QS " at line %d)")
  108. ERRDEF(XFIXUP,    "function too long for return fixup")
  109. ERRDEF(XPARAM,    "<name> or " KTAP_QL("...") " expected")
  110. ERRDEF(XAMBIG,    "ambiguous syntax (function call x new statement)")
  111. ERRDEF(XFUNARG,    "function arguments expected")
  112. ERRDEF(XSYMBOL,    "unexpected symbol")
  113. ERRDEF(XDOTS,    "cannot use " KTAP_QL("...") " outside a vararg function")
  114. ERRDEF(XSYNTAX,    "syntax error")
  115. ERRDEF(XFOR,    KTAP_QL("=") " or " KTAP_QL("in") " expected")
  116. ERRDEF(XBREAK,    "no loop to break")
  117. ERRDEF(XLUNDEF,    "undefined label " KTAP_QS)
  118. ERRDEF(XLDUP,    "duplicate label " KTAP_QS)
  119. ERRDEF(XGSCOPE,    "<goto %s> jumps into the scope of local " KTAP_QS)
  120. ERRDEF(XEVENTDEF,"cannot parse eventdef " KTAP_QS)

  121. /* Bytecode reader errors. */
  122. ERRDEF(BCFMT,    "cannot load incompatible bytecode")
  123. ERRDEF(BCBAD,    "cannot load malformed bytecode")

  124. #undef ERRDEF