Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

298
Vistas
How to rescue an exception from inside a rescue
def func 
   some code...
   rescue x,y,z
      do something...

I have a function where I'm trying to rescue an exception and then do something inside of rescue. I want to understand how to handle in case there is an exception again inside of the rescue block. This is a corner case and it is definitely necessary.

In case there is an exception again inside of rescue I want to be able to handle it. Any suggestions appreciated.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can simply nest a rescue exception inside another rescue exception and you can do so using a number of different approaches depending on the situation but here are a couple:

begin

  do_something

rescue

  do_something_else rescue do_this_instead

end

OR

begin

  do_something

rescue

  begin
    do_something_else
  rescue
    do_this_instead
  end

end
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda