Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of error #14

Open
zudov opened this issue Aug 6, 2018 · 1 comment
Open

Use of error #14

zudov opened this issue Aug 6, 2018 · 1 comment

Comments

@zudov
Copy link

zudov commented Aug 6, 2018

Currently templatewill call anerrorif the template string is malformed, for error-handling there'stemplateSafethat returns anEither`.

I think it would be nicer if the library defined an error type (e.g. TemplateError) and template would throw that instead of an error.

@trskop
Copy link
Collaborator

trskop commented Aug 6, 2018

This could be nicely combined with my proposed solution to #13.

trskop added a commit to trskop/template that referenced this issue Aug 6, 2018
* Alternative API for parsing `Text` into `Template` which allows users to
  specify if they want brackets to be mandatory. Instead of simple
  location this API returns `ParseError` on failure.

* Function `template` throws `ParseError`, instead of calling `error`.
  No other function in existing public API has (visibly) changed.

Addresses issues tibbe#13 and tibbe#14
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

No branches or pull requests

2 participants