Skip to content

Custom Error Handling Prototype#145

Draft
ianjosephwilson wants to merge 32 commits into
t-strings:mainfrom
ianjosephwilson:ian/custom_error_handling
Draft

Custom Error Handling Prototype#145
ianjosephwilson wants to merge 32 commits into
t-strings:mainfrom
ianjosephwilson:ian/custom_error_handling

Conversation

@ianjosephwilson

Copy link
Copy Markdown
Contributor

This is a start on trying to get enough info into an exception to eventually try to print something that could be used to debug an error in the given template(s). Hoping to use this for some brain storming and discussion in #33

This should be stacked on #140 but doesn't involve ParseContext from #141

ParsingError(s)

  • Involves one template (that might contain inlined component children)
  • Should not involve the actual values of the template (unless we use them AFTER an error already occurred)

ProcessingError(s)

  • Recursive: Can occur in a template that was included in another template which was included in another template ... etc.
  • Once an exception occurs try to pack up a state that parallels each template in the recursive stack
    • Try to connect each "leaf" entrypoint with the nearest TNode
    • Try to connect the template and TTree (contains the template TNode root) to the exception
    • Try to catch regular exception in places where they might occur, ie. we try to call a user function, and then chain them with raise ProcessingError() from e
    • We also catch and chain a ParsingError to a ProcessingError
  • When we get back to TemplateProcessor.process() we should have a single ProcessingError that has a stack of error states that go down until we reach the lowest level Template where an error first occurred so we could print something LIKE this (TBD):
div > ... {nested_t}
    div > ... {slider_t}
        span > AttributeProcessingError: aria attribute must be dictionary
Error occurred in <span aria={('role','slider')}></span> at line 1 offset 15 in 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant