Add debug_mode feature in the handle_errors (todo: print on stderr instead of create a error file)