In another lang. there is try catch so I can write the exception to log file , and fix that later.

How can I do it in c? so if I have an error I can see it , write it to log , and my process will not droped

thanks