advanced capstone 2.4 and 2.5

hi. so for 2.4 we have to add some error trapping to our already defined .f1.checkSensor function to catch any incorrect sesnor names. as you can see im using the trap @ function here and i have it placed at this point in my code:

 

so its after the difintion of the mysensoropts dictionary but before the assignemnet of the sensorFilter variable. the function ran perfectly before i added the error trap, now however i am getting a mismatched type error when using either a correct or an incorrect input for the mysenor variable. I understand that the funbction i have in the trap @ is wrong as the function doesnt yield an error, only a 0b when an incorrect value is used. I would like to know how could i alter this function in arg1 of the trap @ so that it causes an error when an incorrect value, eg `temperature is used. also, is the structure of the error message ok or could that also be improved.

 

on 2.5, could i get some guidance on how we are meant to use the profile tool? when i use it i dont really see a proper breakdown of the nested functions involved. is there any material available on how to properly use the profile tool?

thank you in advance, and apologies for the long query 

Trap is best used for errors you can’t or won’t test for. (For example, because the test is expensive and rarely catches anything.) 

If you actually have a test result, consider using Cond $ for an atom or Vector Conditional ? for a vector. 

For a side effect such as writing to stderr, consider the if control word. 

Recommended style: if an expression returns a result (whether an error occurs or not) use Cond, Vector Conditional or Trap/Trap At. If the error leads to side effects (e.g. writing to stderr; Signal an error; or an explicit Return  from the function) use if.

thank you so much, i was confused by the question , i thought we absolutely had to use trap @. i used $ in the end, with error signalling. thank you for your time