add error management
Merge pull request #23 from drealeed/master

add error management