Exception handling

I have a codeunit to create journal entries and post to ledger. In this when there is any error, navision is popping up an error window.

I want to capture all those errors in codeunit itself and add them to a processlog table (custom table). So that at the time of execution there won’t any popups and I can have look at the table later and watch out for any processing errors.

Can someone let me know how to do this.

-Sudhakar