Add Debug.Writeline function

Debug.Writeline function add in each catch block for track error instead
of throw exception.