Guest User

Untitled

a guest
Nov 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. let b = async function() {
  2. throw "bad"
  3. }
  4.  
  5. let a = async function() {
  6. try {
  7. return b();
  8. } catch (e) {
  9. console.log(123)
  10. }
  11.  
  12. }
  13. let c = async function() {
  14. try {
  15. await a()
  16. } catch (e) {
  17. console.log("got it")
  18. }
  19. }
  20.  
  21. c()
  22.  
  23. function intervalFunc() {
  24. console.log('Cant stop me now!');
  25. }
  26.  
  27. setInterval(intervalFunc, 1500);
  28. // output: got it and then cant stop me now
  29.  
  30. let b = async function() {
  31. throw "bad"
  32. }
  33.  
  34. let a = async function() {
  35. return await b();
  36.  
  37. }
  38. let c = async function() {
  39. try {
  40. await a()
  41. } catch (e) {
  42. console.log("got it")
  43. }
  44. }
  45.  
  46. c()
  47.  
  48. function intervalFunc() {
  49. console.log('Cant stop me now!');
  50. }
  51.  
  52. setInterval(intervalFunc, 1500);
  53. // outpub: got it and can't stop me now
  54.  
  55.  
  56.  
  57. let b = async function() {
  58. throw "bad"
  59. }
  60.  
  61. let a = async function() {
  62. try {
  63. return await b();
  64. } catch (e) {
  65. console.log("aaa catch")
  66. }
  67.  
  68. }
  69. let c = async function() {
  70. try {
  71. await a()
  72. } catch (e) {
  73. console.log("got it")
  74. }
  75. }
  76.  
  77. c()
  78.  
  79. function intervalFunc() {
  80. console.log('Cant stop me now!');
  81. }
  82.  
  83. setInterval(intervalFunc, 1500);
  84. // output: got it and can't stop me now
  85.  
  86.  
  87.  
  88. let b = async function() {
  89. throw "bad"
  90. }
  91.  
  92. let a = function() {
  93. try {
  94. return b();
  95. } catch (e) {
  96. console.log("aaa catch")
  97. }
  98.  
  99. }
  100. let c = async function() {
  101. try {
  102. await a()
  103. } catch (e) {
  104. console.log("got it")
  105. }
  106. }
  107.  
  108. c()
  109.  
  110. function intervalFunc() {
  111. console.log('Cant stop me now!');
  112. }
  113.  
  114. setInterval(intervalFunc, 1500);
  115. // output: got it and can't stop me now
Add Comment
Please, Sign In to add comment