new api service and logic implemented
This commit is contained in:
14
ApiLayers/ApiLibrary/common/line_number.py
Normal file
14
ApiLayers/ApiLibrary/common/line_number.py
Normal file
@@ -0,0 +1,14 @@
|
||||
"""Utility functions for getting line numbers and file locations."""
|
||||
|
||||
from inspect import currentframe, getframeinfo, stack
|
||||
|
||||
|
||||
def get_line_number_for_error() -> str:
|
||||
"""Get the file name and line number of where an error occurred.
|
||||
|
||||
Returns:
|
||||
str: A string in the format 'filename | line_number' showing where the error occurred
|
||||
"""
|
||||
caller = stack()[1] # Get the caller's frame
|
||||
frameinfo = getframeinfo(caller[0])
|
||||
return f"{frameinfo.filename} | {frameinfo.lineno}"
|
||||
Reference in New Issue
Block a user