Add Uptated-Prototype/Code-Snippets/ErrorMsg.py
This commit is contained in:
13
Uptated-Prototype/Code-Snippets/ErrorMsg.py
Normal file
13
Uptated-Prototype/Code-Snippets/ErrorMsg.py
Normal file
@@ -0,0 +1,13 @@
|
||||
def ErrorMsg(string = None, exception = None):
|
||||
try:
|
||||
print(f"An Exception has occured when attempting to - {string}\nException: {exception}\nClass: {type(exception)}")
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
#x = "Hello!"
|
||||
|
||||
try:
|
||||
print(x)
|
||||
except Exception as MyException:
|
||||
print(ErrorMsg("Print", MyException))
|
||||
Reference in New Issue
Block a user