Add CrashEngine exception.

R=tandrii@chromium.org

Bug: 910369
Change-Id: Iac9d92d273ec159bf6676b54693f203c031a4a22
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/1601453
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/recipe_engine/internal/exceptions.py b/recipe_engine/internal/exceptions.py
index b4602c2..f1dcc5a 100644
--- a/recipe_engine/internal/exceptions.py
+++ b/recipe_engine/internal/exceptions.py
@@ -53,3 +53,16 @@
 class UnresolvedRefspec(RecipeEngineError):
   """Raised from fetch.Backend.assert_resolved if the given revision is,
   in fact, not resolved."""
+
+
+### BaseException-derived exceptions.
+
+class CrashEngine(BaseException):
+  """Raised from the engine when the user-provided functions (like step
+  callbacks) raise an exception.
+
+  This exception should only be handled by the recipe engine.
+  """
+  def __init__(self, reason):
+    super(CrashEngine, self).__init__(reason)
+    self.reason = reason