Skip to content

Commit

Permalink
refactor: put all expansion custom error from the sh_expand library (…
Browse files Browse the repository at this point in the history
…expand.py file) under one ExpansionError class in custom_error to catch and log these errors separately
  • Loading branch information
YUUU23 committed Jun 11, 2024
1 parent ad2b687 commit c7ce083
Show file tree
Hide file tree
Showing 3 changed files with 525 additions and 2 deletions.
5 changes: 4 additions & 1 deletion compiler/custom_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ class UnparallelizableError(Exception):
pass

class AdjLineNotImplementedError(Exception):
pass
pass

class ExpansionError(RuntimeError):
pass
4 changes: 3 additions & 1 deletion compiler/pash_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def compile_ir(ir_filename, compiled_script_file, args, compiler_config):
ret = compile_optimize_output_script(
ir_filename, compiled_script_file, args, compiler_config
)
except UnparallelizableError as e:
except ExpansionError as e:
log("WARNING: Exception caught because some region(s) are not expandable and therefore unparallelizable:", e)
except (ExpansionError, UnparallelizableError) as e:
log("WARNING: Exception caught because some region(s) are unparallelizable:", e)
# log(traceback.format_exc()) # uncomment for exact trace report (PaSh user should see informative messages for unparellizable regions)
except (AdjLineNotImplementedError, NotImplementedError) as e:
Expand Down
Loading

0 comments on commit c7ce083

Please sign in to comment.