Skip to content

Upgrade underscore.string? #64609

Description

@yelizariev

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)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions