Closed ginty closed 4 years ago
Looks good! I had encountered the same but I figured you just wanted it to panic. I'm in favor of this though.
Spec fail looked odd too. Didn't install python 3.8. But it passed in the push. I just restarted the PR 3.8. We'll see what happens the second time but might need to add a 'redo' in the yml to account for random failures out of our control.
Yeah, it passed second time through... I was watching it. Really curious as to what it'd do. lol.
Cool, thanks @coreyeng
Hi @coreyeng, another AST processor update...
I've got a STIL parser now working and have moved onto processing it. When writing a real-life processor It quickly became clear that they will be able to generate errors and currently the only way to deal with those is to panic.
This update makes all processor's
on_node
methods return aResult<Return>
instead of just aReturn
code.I toyed with adding an error code to the existing
Return
enum, however that would mean that?
couldn't be used within theon_node
implementations to bubble errors which would be inconvenient and unexpected/unusual from a coding perspective. I had a look to see if there was a result trait that could be added toReturn
, but I couldn't find anything like that.The net effect of this on processors doesn't seem too bad, and basically boils down to returning something like
Ok(Return::ProcessChildren)
instead ofReturn::ProcessChildren
.