Spaces:
Build error
Build error
Download src/exception.py from rahul2001/student_performance: direct link, hf CLI and curl.
- Browser
- Download file 707 Bytes
-
https://huggingface.co/spaces/rahul2001/student_performance/resolve/main/src/exception.py
- Command line
-
hf download hf://spaces/rahul2001/student_performance/src/exception.py
-
curl -L -o exception.py https://huggingface.co/spaces/rahul2001/student_performance/resolve/main/src/exception.py
707 Bytes
| import sys | |
| from src.logger import logging | |
| def error_message_detail(error,error_detail:sys): | |
| _,_,exc_tb = error_detail.exc_info() | |
| file_name =exc_tb.tb_frame.f_code.co_filename | |
| error_message = "error occured in python script name [{0}] line number [{1}] error message [{2}]".format(file_name,exc_tb.tb_lineno,str(error)) | |
| return error_message | |
| class CustomException(Exception): | |
| def __init__(self,error_message,error_detail:sys) -> None: | |
| super().__init__(error_message) | |
| self.error_message = error_message_detail(error_message,error_detail=error_detail) | |
| logging.info(self.error_message) | |
| def __str__(self) -> str: | |
| return self.error_message | |