Carlos Ble

Carlos Ble

I am a professional software developer, I solve problems.

I also teach and mentor developers to build better software.

Working as an independent professional since 2009.

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. [in English] May 5, 6 & 7
    TDD - Train the Trainers (iSQI)
    Potsdam, Berlin
  2. [en Español] 23, 24 y 25 de Abril.
    Curso de TDD con examen de certificacion iSQI
    Madrid
  3. [en Español] 29, 30 y 31 de Octubre.
    Curso de TDD con examen de certificacion iSQI
    Madrid

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