<div dir="ltr">Hi there,<div><br></div><div>Its a nice idea for you to send it out, but it is also sending a lot of info for a full list, where no-one of us asked for it. So could you not instead send 1 mail with the relevant links & suggestions, etc. instead of forcing a daily mail?</div><div><br></div><div>Thanks :)</div><div><br></div><div>Best,</div><div>Chris.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 December 2016 at 18:07, Holbok István <span dir="ltr"><<a href="mailto:holbok@gmail.com" target="_blank">holbok@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
    
  
  <div style="margin:0;padding:0;width:100%!important" bgcolor="#FFFFFF" text="#000000">
    
    <div id="m_-638219678219852259main-content" style="color:#222222;font-family:'Helvetica','Arial',sans-serif;font-size:14px;line-height:1.4;padding:25px;width:550px">Today, in day 4 of our 5-day
      mini-course, we're going to discuss <strong style="font-weight:bold">Error handling</strong>.
      <h2 style="color:black!important;font-size:16px;font-weight:bold;margin:0 0 12px;padding:0">
        <br>
        Error handling</h2>
      <p style="margin:1em 0">For a long while, error handling was just
        about magical status codes for us. You know what I am talking
        about, right?</p>
      <p style="margin:1em 0">When user submits an order, return 0 when
        the date is expired, return 1 when there is no more stock,
        return 2 when user is not eligible for current order, return 3
        when user is not logged in, and return 4 when order is placed
        successfully.</p>
      <p style="margin:1em 0">Have you done anything similar above? If
        so, you need to learn a better way of error handling. We did,
        and we’ve never looked back.</p>
      <p style="margin:1em 0">Error codes are terrible; they are
        meaningless to new developers; are hard to keep track of because
        they contain no real information.</p>
      <p style="margin:1em 0">Error handling should be done properly
        with exceptions.</p>
      <p style="margin:1em 0">A lot of errors in our applications are
        exceptions. They are exceptional cases in our applications,
        which we should handle directly as soon as they occur.</p>
      <p style="margin:1em 0">PHP introduced Exception class in PHP 5.</p>
      <p style="margin:1em 0">Similar to exceptions in other languages,
        an exception is "thrown" when an error occurs:</p>
      <pre>throw new Exception('No more stock')
</pre>
      And an Exception class ought to be handled in a catch clause:
      <pre>catch (Exception $e) {
     echo 'Caught exception: ',  $e->getMessage(), "\n";
}
</pre>
      To make sure some code always runs such as closing a database
      connection, we use a finally clause:
      <pre>finally {
     // close PDO connection
}
</pre>
      Now you know error handling does not mean returning magical codes.
      Using exceptions to handle exceptional cases is the way to go!<br>
      <br>
      Tomorrow, in the final installment of this course, we'll take a
      look at <strong style="font-weight:bold"><span style="line-height:1.6">Test Driven Development</span>.</strong><br>
      <br>
      You won't want to miss it,<br>
      <br>
      Keep learning!<br>
      Xu<br>
      <a class="m_-638219678219852259moz-txt-link-abbreviated" href="http://www.startutorial.com" target="_blank">www.startutorial.com</a><br>
      <br>
       </div>
    <div id="m_-638219678219852259footer" style="border-top-color:#d0d0d0;border-top-style:solid;border-top-width:1px;color:#777;font-family:'Helvetica','Arial',sans-serif;font-size:13px;line-height:1.4;padding:25px;width:550px">Kindest regards:<br>
      Istvan Holbok<br>
    </div>
    <img src="cid:part1.85B421AF.EAB3A2D3@gmail.com" alt="" style="height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important" height="1" border="0" width="1">
  </div>

<br>______________________________<wbr>_________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div>