Skip to content
This repository was archived by the owner on May 23, 2019. It is now read-only.

Throw slightly better error message when a context variable is not provided#168

Merged
jasonmit merged 1 commit intoformatjs:masterfrom
charlespwd:master
Aug 8, 2017
Merged

Throw slightly better error message when a context variable is not provided#168
jasonmit merged 1 commit intoformatjs:masterfrom
charlespwd:master

Conversation

@charlespwd
Copy link
Contributor

Instead of throwing

'A value must be provided for: ' + id, 

I throw

`The intl string context variable '${e.variableId}' was not provided to the string '${message}`

It makes for easier debugging in production.

@yahoocla
Copy link

yahoocla commented Aug 7, 2017

Thank you for submitting this pull request, however I do not see a valid CLA on file for you. Before we can merge this request please visit https://yahoocla.herokuapp.com/ and agree to the terms. Thanks! 😄

@jasonmit
Copy link
Collaborator

jasonmit commented Aug 8, 2017

@charlespwd can you add tests?

@charlespwd
Copy link
Contributor Author

Sure, how about that?

@jasonmit
Copy link
Collaborator

jasonmit commented Aug 8, 2017

Thanks!

@jasonmit jasonmit merged commit 33f175c into formatjs:master Aug 8, 2017
@jasonmit
Copy link
Collaborator

jasonmit commented Aug 8, 2017

@okuryu please cut a 2.1.0 release when you can.

@okuryu
Copy link
Member

okuryu commented Aug 8, 2017

@jasonmit sure, I'll work on it within a week! thanks for your helping. 😎

@okuryu okuryu mentioned this pull request Aug 11, 2017
@Floriferous
Copy link

Can you actually use other in a select message? It seems like the code is setup for it, but this error will throw regardless of an other existing in the message.

For example {gender, select, M {Male} F {Female} other {Someone}} will throw if no gender variable has been provided, is that normal?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants