Carlos Ble

Carlos Ble

I am a professional software developer, I solve problems.

I also teach and mentor developers to build better software.

Developing software since 2001.

Can I help you?

  • Do you need high quality tailor-made software?
  • Need training on TDD, clean code or refactoring?
  • Do you need a technical consultant?
  • May I pair with you to write better code?

Events

Upcoming training courses:

  1. TDD - [en Español] - 6 y 7 Octubre
    Gran Canaria
  2. TDD - [in English] - October 20, 21 & 22
    London, UK
  3. TDD - [en Español] - 29, 30 y 31 de Octubre.
    Madrid, Spain

Conferences:

  1. I'll be at the Agile Testing Days 2014
  2. I'll be at the London Test Gathering Workshops.

Catch the exception and throw it again

Same behavior in Python and C#...
Wrong code:

  1.  
  2. try:
  3. # some code
  4. except Exception, e:
  5. # log the exception or whatever
  6. raise e
  7.  

Right code:

  1.  
  2. try:
  3. # some code
  4. except Exception, e:
  5. # log the exception or whatever
  6. raise # JUST RAISE!!!
  7.  

Wrong code:

  1.  
  2. try
  3. {
  4. // whatever
  5. }
  6. catch (Exception e)
  7. {
  8. // log the exception or whatever
  9. throw e
  10. }
  11.  

Right:

  1.  
  2. try
  3. {
  4. // whatever
  5. }
  6. catch (Exception e)
  7. {
  8. // log the exception or whatever
  9. throw // JUST THROW!!!
  10. }
  11.  

Reason: Exception stacktrace is lost if you write "raise e" or "throw e" instead of just "raise" or "throw".

Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.
  • http://bloguay.com/cheapuggs215/2011/12/15/uggs-nevertheless/ uggs

    i have got both DTS and Dolby Surround home theather system at home and the sound is superb