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

Upgrade underscore.string? #64609

Open
yelizariev opened this issue Jan 15, 2021 · 1 comment
Open

Upgrade underscore.string? #64609

yelizariev opened this issue Jan 15, 2021 · 1 comment
Labels

Comments

@yelizariev
Copy link
Contributor

This is a suggestion for master branch.

Currently using version throws not informative errrors:

throw new Error('[_.sprintf] huh?');
}
}
}
else {
throw new Error('[_.sprintf] huh?');
}
match[2] = field_list;
}
else {
arg_names |= 2;
}
if (arg_names === 3) {
throw new Error('[_.sprintf] mixing positional and named placeholders is not (yet) supported');
}
parse_tree.push(match);
}
else {
throw new Error('[_.sprintf] huh?');

Compare with latest version:

https://github.com/esamattis/underscore.string/blob/df8dc9ea7e84ef3313d7c61d47da9d7bcc353ef8/dist/underscore.string.js#L754-L772

More precisely, I'd like to have a better error message when format is broken in translations (see #64557 )


Ошибка:
Uncaught Error: [_.sprintf] huh?

https://5762317-14-0.runbot35.odoo.com/web/static/lib/underscore.string/lib/underscore.string.js:176
Отслеживающий:
Error: [_.sprintf] huh?
    at Function.str_format.parse (https://5762317-14-0.runbot35.odoo.com/web/static/lib/underscore.string/lib/underscore.string.js:176:17)
    at Object.str_format [as sprintf] (https://5762317-14-0.runbot35.odoo.com/web/static/lib/underscore.string/lib/underscore.string.js:79:53)
    at Class._onElementRemoved (https://5762317-14-0.runbot35.odoo.com/web_studio/static/src/js/views/view_editor_sidebar.js:948:29)
    at HTMLButtonElement.<anonymous> (https://5762317-14-0.runbot35.odoo.com/web/static/src/js/core/mixins.js:277:23)
    at HTMLDivElement.dispatch (https://5762317-14-0.runbot35.odoo.com/web/static/lib/jquery/jquery.js:5183:27)
    at HTMLDivElement.elemData.handle (https://5762317-14-0.runbot35.odoo.com/web/static/lib/jquery/jquery.js:4991:28)
@yelizariev
Copy link
Contributor Author

I also made a PR to the lib to provide more context in error message
esamattis/underscore.string#526

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants