go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/lucicfg/testdata/misc/errors.star (about)

     1  load("@stdlib//internal/error.star", "error")
     2  
     3  def func1():
     4      error("hello %s", "world")
     5  
     6  def capture_stack():
     7      return stacktrace()
     8  
     9  def func2():
    10      return capture_stack()
    11  
    12  s = func2()
    13  
    14  func1()
    15  error("another err", trace = s)
    16  
    17  # Expect errors:
    18  #
    19  # Traceback (most recent call last):
    20  #   //testdata/misc/errors.star: in <toplevel>
    21  #   //testdata/misc/errors.star: in func1
    22  #   @stdlib//internal/error.star: in error
    23  # Error: hello world
    24  #
    25  # Traceback (most recent call last):
    26  #   //testdata/misc/errors.star: in <toplevel>
    27  #   //testdata/misc/errors.star: in func2
    28  #   //testdata/misc/errors.star: in capture_stack
    29  #   <builtin>: in stacktrace
    30  # Error: another err