re-writing Exception class and Warning class