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?
  • Is it risky? do you need advise?
  • May I pair with you to write better code?

Events

Upcoming public training courses:

  1. [Online - en Español] 25 y 26 de Junio
    Test Doubles con JavaScript - Online
  2. [in English] July 7, 8 & 9
    TDD (open to the public) - Tenerife, Canary Islands
  3. [en Español] 14 y 15 Julio
    TDD (en abierto) - Gran Canaria, Canary Islands
  4. [in English] October 13, 14 & 15
    TDD (open to the public) - London, UK
  5. [en Español] 29, 30 y 31 de Octubre.
    TDD (en abierto) - Madrid, Spain

Conferences:

  1. I'll be at SocratesUK 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