-
Notifications
You must be signed in to change notification settings - Fork 13
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
Bug: getting an email template by label #537
Comments
@mabiede Could we somehow have a fallback mechanism, maybe a fallback language? |
@mabiede @joseferben I think since the users can specify their own languages, we can't generally have a fallback language. Maybe we could just return the first one that is found (from a list)? |
@joseferben @aronerben IMO, there doesn't need to be a fallback. Either the developer chooses to skip the optional language field or he uses it. If there is only one template for a label specified (e.g. single language) this will be returned. In case of a fallback, may also add an |
@mabiede and I had another discussion. If we want to avoid throwing exceptions (which I think Sihl should avoid, or mark the function with
* This implies adding a |
@mabiede @aronerben I like the |
I like it. |
When storing the email templates with the additional
language
argument, it's possible to get an error when using theEmailTemplate.get_by_label
function (without passing thelanguage
argument).It allows e.g. creating a template for multiple languages with the same label. But when reading them without the language argument you'd receive a list and not
Sihl_email.Template.t option Lwt.t
as it is now.This is an edge case and could be a wanted exception. Either both (create and get) have to use the language argument or neither of them. (Sorry, I missed adding this test)
I'd suggest keeping the signature and writing a warning to the console, that the function was called without the needed language argument (and returning
Lwt.return_none
).@joseferben ping
The text was updated successfully, but these errors were encountered: