How to exit the function if any error -python

0 votes

i want to exit the code then and there if there is any error raised in lambda python instead of code running further. how do i do that with below code.

how do exit if logger.error shows any error

``` 
if df.shape[0] > 0:

  for i in range(len(df)): 

     values = f"{df['RMA'][i]},{df['serial_number'][i]},{df['code_type'][i]},{df['date_opened'][i]},{df['created_by'][i]},{df['rma_customer'][i]},         {df['acacia_component_pn'][i]},{df['component_engineer'][i]},{df['product_engineer'][i]},{df['qty'][i]},{df['test_process'][i]},{df['reference'][i]},{df['component_supplier_name'][i]},{df['component_supplier_pn'][i]},{df['component_supplier_date_code'][i]},\ {df['component_supplier_lot_code'][i]},{df['severity_class'][i]},{df['component_failure_detail'][i]},{df['supplier_RMA'][i]},{df['fa_owner'][i]},{df['AW_ref_bill'][i]},{df['component_shipped_to_supplier'][i]},{df['component_received_by_supplier'][i]},{df['supplier_fa_received'][i]},{df['is_active'][i]},{df['cfar_open_date'][i]},{df['cfar_closed_date'][i]},{df['Unit_Fault_Diagnosis'][i]}" 

     response = client.service.fn_Log("279", "xyz", "xyz", "RMA", "xyz", "1", parameters, values, ",") 

      if (response.Message != None) | (response.Result != 'True'): logger.error(i) logger.error(values) logger.error(response) 

``` 

Dec 8, 2022 in Python by anonymous

edited 5 days ago 4 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP