Spaces:
Sleeping
Sleeping
Merge branch 'main' of https://github.com/rahul-jha-2001/ml_project
Browse files- src/exception.py +11 -1
src/exception.py
CHANGED
|
@@ -14,4 +14,14 @@ class CustomException(Exception):
|
|
| 14 |
self.error_message = error_message_detail(error_message,error_detail=error_detail)
|
| 15 |
logging.info(self.error_message)
|
| 16 |
def __str__(self) -> str:
|
| 17 |
-
return self.error_message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
self.error_message = error_message_detail(error_message,error_detail=error_detail)
|
| 15 |
logging.info(self.error_message)
|
| 16 |
def __str__(self) -> str:
|
| 17 |
+
return self.error_message
|
| 18 |
+
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
|
| 21 |
+
try:
|
| 22 |
+
a = 1/0
|
| 23 |
+
except Exception as e:
|
| 24 |
+
logging.info("Logging has started")
|
| 25 |
+
raise CustomException
|
| 26 |
+
finally:
|
| 27 |
+
logging.info(CustomException(e,sys))
|