Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl

Issue 2809003004: bindings: Use ExceptionMessages when an interface/callback conversion fails. (Closed)
Patch Set: Add ExceptionMessages::FailedToConvertJSValue Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {% extends 'interface_base.cpp.tmpl' %} 1 {% extends 'interface_base.cpp.tmpl' %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% block indexed_property_getter %} 4 {% block indexed_property_getter %}
5 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 5 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
6 {% set getter = indexed_property_getter %} 6 {% set getter = indexed_property_getter %}
7 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) { 7 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) {
8 {% if getter.is_raises_exception %} 8 {% if getter.is_raises_exception %}
9 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kIndexedGette rContext, "{{interface_name}}"); 9 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kIndexedGette rContext, "{{interface_name}}");
10 {% endif %} 10 {% endif %}
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 {% endif %} 886 {% endif %}
887 } 887 }
888 888
889 {% endblock %} 889 {% endblock %}
890 890
891 891
892 {##############################################################################} 892 {##############################################################################}
893 {% block native_value_traits %} 893 {% block native_value_traits %}
894 {{cpp_class}}* NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolat e, v8::Local<v8::Value> value, ExceptionState& exceptionState) { 894 {{cpp_class}}* NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolat e, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
895 {{cpp_class}}* nativeValue = {{v8_class}}::toImplWithTypeCheck(isolate, value) ; 895 {{cpp_class}}* nativeValue = {{v8_class}}::toImplWithTypeCheck(isolate, value) ;
896 if (!nativeValue) 896 if (!nativeValue) {
897 exceptionState.ThrowTypeError("Unable to convert value to {{interface_name}} ."); 897 exceptionState.ThrowTypeError(ExceptionMessages::FailedToConvertJSValue(
898 "{{interface_name}}"));
899 }
898 return nativeValue; 900 return nativeValue;
899 } 901 }
900 902
901 {% endblock %} 903 {% endblock %}
902 904
903 905
904 {##############################################################################} 906 {##############################################################################}
905 {% block partial_interface %} 907 {% block partial_interface %}
906 {% if has_partial_interface %} 908 {% if has_partial_interface %}
907 {% if needs_runtime_enabled_installer %} 909 {% if needs_runtime_enabled_installer %}
(...skipping 24 matching lines...) Expand all
932 } 934 }
933 935
934 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 936 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
935 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) { 937 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) {
936 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 938 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
937 } 939 }
938 940
939 {% endfor %} 941 {% endfor %}
940 {% endif %} 942 {% endif %}
941 {% endblock %} 943 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698