You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would you be open on a Parser that doesn't throw Exceptions but instead returns ParsingResults with the MustacheTemplate inside it, and the ParserContext. And in case of a failure the ParsingFailure and the state of the Processor up until this point to be included?
Then on the Rendering Side of things, the possible exceptions could be unwrapped and be thrown.
I'm considering into using your Parser for a LanguageServer I'm making to provide IntelliSense for Monaco Editors for Mustache. Exceptions are heavy, so I was thinking if you're open on this idea on converting your parser to support returning this Structure and exiting early when a failure happens, without the throwing of an exception.
This could be achieved in two ways; the first approach would be for all the Inline/Block parsers to return a Struct/Class object with the result of their processing. This however would throw an exception on an unhandled issue. The second approach would be to use LanguageExt and utilized their monads which can be used to catch an exception as early as possible and wrap it in a Try<>, Unit, Either<,> or whatever else. This minimizes the impact of the exception throwing.
The text was updated successfully, but these errors were encountered:
ProIcons
changed the title
[Question/Discussion]
[Question/Discussion] Rework of the Parser to support more information on its output
Oct 2, 2022
Would you be open on a Parser that doesn't throw Exceptions but instead returns
ParsingResult
s with theMustacheTemplate
inside it, and theParserContext
. And in case of a failure theParsingFailure
and the state of the Processor up until this point to be included?Then on the Rendering Side of things, the possible exceptions could be unwrapped and be thrown.
I'm considering into using your Parser for a LanguageServer I'm making to provide IntelliSense for Monaco Editors for Mustache. Exceptions are heavy, so I was thinking if you're open on this idea on converting your parser to support returning this Structure and exiting early when a failure happens, without the throwing of an exception.
This could be achieved in two ways; the first approach would be for all the Inline/Block parsers to return a Struct/Class object with the result of their processing. This however would throw an exception on an unhandled issue. The second approach would be to use LanguageExt and utilized their monads which can be used to catch an exception as early as possible and wrap it in a
Try<>, Unit, Either<,>
or whatever else. This minimizes the impact of the exception throwing.The text was updated successfully, but these errors were encountered: