Approach to detect run time error

While solving a bigger problems some time it just sucks to detect a run time error, is there any general approach to detect runtime error(NZEC).