try_as#
- pyCGM2.Utils.files.try_as(loader, s, on_error)#
Attempt to parse a string with a given loader and catch specific errors.
- Parameters:
loader (callable) – The function used to load and parse the string.
s (str) – The string to be parsed.
on_error (Exception) – The exception type to catch.
- Returns:
bool – True if parsing is successful, False otherwise.