How to use raise in recipe

Hello,

All I want to check the java version installed is the required version if not do not proceed and thought a simple one liner raise will do the trick.

The recipe is working, no compile error but it is not throwing error..

What I have is just one line

raise "this is my message" if node['required_version'] != node['languages']['java']['version']

I tried to use variables, used #{node syntax etc but it didn't work. what may be the correct syntax..

Thanks

M

Well,

I was missing .to_s and it worked :frowning:

so I need

raise "this is my message" if node['required_version'].to_s != node['languages']['java']['version'].to_s

Is there a way to suppress Cookbook Trace when raise is thrown?