Throw.k 830 B

1234567891011121314151617181920212223242526272829303132
  1. promise {
  2. await x = promise {
  3. throw custom_error('intentional error 1')
  4. } -> catch -> lambda(err) {
  5. return 5
  6. }
  7. await y = promise {
  8. await postpone(50)
  9. return 1
  10. } -> then -> lambda(val) {
  11. throw custom_error('intentional error 2')
  12. } -> catch -> lambda(err) {
  13. return 7
  14. }
  15. await z = promise {
  16. await postpone(50)
  17. throw custom_error('intentional error 3')
  18. } -> catch -> lambda(err) {
  19. throw custom_error('intentional error 4')
  20. } -> catch -> lambda(err) {
  21. return 11
  22. }
  23. await w = promise {
  24. throw custom_error('intentional error 5')
  25. } -> finally -> lambda(err) {
  26. throw custom_error('intentional error 6')
  27. } -> catch -> lambda(err) {
  28. return 13
  29. }
  30. assert x*y*z*w == 5*7*11*13
  31. }