cpython/Lib/profiling/sampling/errors.py
Keming d4095f25e8
gh-142654: show the clear error message when sampling on an unknown PID in tachyon (#142655)
Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
2025-12-17 14:15:22 +00:00

19 lines
724 B
Python

"""Custom exceptions for the sampling profiler."""
class SamplingProfilerError(Exception):
"""Base exception for sampling profiler errors."""
class SamplingUnknownProcessError(SamplingProfilerError):
def __init__(self, pid):
self.pid = pid
super().__init__(f"Process with PID '{pid}' does not exist.")
class SamplingScriptNotFoundError(SamplingProfilerError):
def __init__(self, script_path):
self.script_path = script_path
super().__init__(f"Script '{script_path}' not found.")
class SamplingModuleNotFoundError(SamplingProfilerError):
def __init__(self, module_name):
self.module_name = module_name
super().__init__(f"Module '{module_name}' not found.")