• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/03_stdlib/02_die

  1 The `die()` function triggers a user defined runtime exception when invoked,
  2 using the given value as exception message.
  3 
  4 The given message value is converted to a string internally if it is not a
  5 string already. If no message argument is given or if the message argument
  6 is `null`, the default message is `Died`.
  7 
  8 The function does not return.
  9 
 10 -- Testcase --
 11 {%
 12         print("Before invoking die()\n");
 13 
 14         die("An exception!");
 15 
 16         print("After invoking die()\n");
 17 %}
 18 -- End --
 19 
 20 -- Expect stdout --
 21 Before invoking die()
 22 -- End --
 23 
 24 -- Expect stderr --
 25 An exception!
 26 In line 4, byte 21:
 27 
 28  `    die("An exception!");`
 29   Near here -------------^
 30 
 31 
 32 -- End --
 33 
 34 
 35 -- Testcase --
 36 {%
 37         die();
 38 %}
 39 -- End --
 40 
 41 -- Expect stderr --
 42 Died
 43 In line 2, byte 6:
 44 
 45  `    die();`
 46           ^-- Near here
 47 
 48 
 49 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt