<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font size="4">In case there may be someone out there who is
      interested in my question, below is Asim's answer (with one
      correction he made).    When run in the Python console, this code
      causes execution of the script to stop and a window to pop up
      titled "Execution error" with my explanatory message.  And, unlike
      quit() and exit(), it does NOT terminate QGIS.<br>
      <br>
      fName = 'xyz'<br>
      vrbl = False<br>
      class MyExcpt(Exception):<br>
          pass<br>
      <br>
      if not vrbl:<br>
          raise MyExcpt("Unable to find file %s" % fName)<br>
      <br>
      print ('abc')<br>
      <br>
    </font>
  </body>
</html>