Skip to content
Snippets Groups Projects
Commit fb348096 authored by Tobias S. Josefowitz's avatar Tobias S. Josefowitz
Browse files

Concurrent: Explicit error on executor rejection failure

This is not perfect (as we currently have no way of properly chaining
errors), but this should provide more helpful error messages to
developers who somehow manage to throw in the executor after finalising
the promise some other way.
parent ac982abd
Branches
Tags
No related merge requests found
......@@ -917,8 +917,20 @@ class Promise
// in the executor will leave our caller with an error about the
// Promise already having been finalized, not giving anyone too much
// information about where the double-finalization occured...
if (err)
failure(err);
if (err) {
if (mixed err2 = catch(failure(err))) {
string finalisation_error;
if (catch(finalisation_error = describe_error(err2)))
finalisation_error = sprintf("%O", err2);
while (has_suffix(finalisation_error, "\n"))
finalisation_error = finalisation_error[..<1];
error("%O->create(): Got error \"%s\" while trying to finalise promise with %O thrown by executor.\n",
this, finalisation_error, err);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment