title: How can I get Express to realize there was an error with my Teradata database call?
body: <p>Currently I have Express running a call against my Teradata database and it acts/performs perfectly when everything works.</p>
  
  <p>However if my Teradata call returns an error I see an output in my console window but I cannot setup an error handler.</p>
  
  <p>I realize this should be extremely basic but I am very new to Express. Any help would be appreciated.</p>
  
  <p>Express Call code:</p>
  
  <pre class="lang-js prettyprint-override"><code>router.post('/sp_run', function (req, res) {
      var sql = "CALL DB.STORED_PROC1(1,P_ERROR_CODE,P_MSG);";
      console.log(sql);
    return teradata.read(sql)
        .then((x) =&gt; {
          console.log(x);
     res.send(x);
        });
    });
  </code></pre>
  
  
  
  <p>Error info I see in my console.</p>
  
  <pre class="lang-js prettyprint-override"><code>CALL DB.STORED_PROC1(1,P_ERROR_CODE,P_MSG);
  express_1  | 2019-6-27 21:07:10 - error: [Teradata] Unable to execute query: CALL DB.STORED_PROC1(1,P_ERROR_CODE,P_MSG);
  express_1  | Unhandled rejection Error: Error running instance method
  express_1  | java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.10] [Error 7627] [SQLState HY000] STORED_PROC1:SELECT-INTO returned more than one row.
  </code></pre>
  
  
  
  <p><strong>End game result -- if an error occurs I want to send an email and to send a response back so my front-end isn't just waiting for ever.</strong></p>