@@ -183,6 +183,11 @@ module API {
183
183
*/
184
184
Node getPromised ( ) { result = getASuccessor ( Label:: promised ( ) ) }
185
185
186
+ /**
187
+ * Gets a node representing the error wrapped in the `Promise` object represented by this node.
188
+ */
189
+ Node getPromisedError ( ) { result = getASuccessor ( Label:: promisedError ( ) ) }
190
+
186
191
/**
187
192
* Gets a string representation of the lexicographically least among all shortest access paths
188
193
* from the root to this node.
@@ -468,6 +473,9 @@ module API {
468
473
or
469
474
lbl = Label:: promised ( ) and
470
475
PromiseFlow:: storeStep ( rhs , pred , Promises:: valueProp ( ) )
476
+ or
477
+ lbl = Label:: promisedError ( ) and
478
+ PromiseFlow:: storeStep ( rhs , pred , Promises:: errorProp ( ) )
471
479
)
472
480
or
473
481
exists ( DataFlow:: ClassNode cls , string name |
@@ -482,6 +490,12 @@ module API {
482
490
rhs = f .getAReturn ( )
483
491
)
484
492
or
493
+ exists ( DataFlow:: FunctionNode f |
494
+ base = MkAsyncFuncResult ( f ) and
495
+ lbl = Label:: promisedError ( ) and
496
+ rhs = f .getExceptionalReturn ( )
497
+ )
498
+ or
485
499
exists ( int i |
486
500
lbl = Label:: parameter ( i ) and
487
501
argumentPassing ( base , i , rhs )
@@ -559,6 +573,9 @@ module API {
559
573
or
560
574
lbl = Label:: promised ( ) and
561
575
PromiseFlow:: loadStep ( pred , ref , Promises:: valueProp ( ) )
576
+ or
577
+ lbl = Label:: promisedError ( ) and
578
+ PromiseFlow:: loadStep ( pred , ref , Promises:: errorProp ( ) )
562
579
)
563
580
or
564
581
exists ( DataFlow:: Node def , DataFlow:: FunctionNode fn |
@@ -962,6 +979,9 @@ private module Label {
962
979
963
980
/** Gets the `promised` edge label connecting a promise to its contained value. */
964
981
string promised ( ) { result = "promised" }
982
+
983
+ /** Gets the `promisedError` edge label connecting a promise to its rejected value. */
984
+ string promisedError ( ) { result = "promisedError" }
965
985
}
966
986
967
987
private class NodeModuleSourcesNodes extends DataFlow:: SourceNode:: Range {
0 commit comments