Check out example codes for "rails catch mail error". It will help you in understanding the concepts better.

Code Example 1

begin
        UserMailer.welcome_email(@user).deliver
        flash[:success] = "#{@user.name} created"
      rescue Net::SMTPAuthenticationError, Net::SMTPServerBusy, Net::SMTPSyntaxError, Net::SMTPFatalError, Net::SMTPUnknownError => e
        flash[:success] = "Utente #{@user.name} creato. Problems sending mail"
      end

Learn ReactJs, React Native from akashmittal.com