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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/callback_function.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 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %} 1 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %}
2 {% filter format_blink_cpp_source_code %} 2 {% filter format_blink_cpp_source_code %}
3 3
4 {% include 'copyright_block.txt' %} 4 {% include 'copyright_block.txt' %}
5 5
6 #include "{{cpp_class}}.h" 6 #include "{{cpp_class}}.h"
7 7
8 {% for filename in cpp_includes %} 8 {% for filename in cpp_includes %}
9 #include "{{filename}}" 9 #include "{{filename}}"
10 {% endfor %} 10 {% endfor %}
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 {% if return_value %} 76 {% if return_value %}
77 {{v8_value_to_local_cpp_value(return_value) | indent(2)}} 77 {{v8_value_to_local_cpp_value(return_value) | indent(2)}}
78 returnValue = cppValue; 78 returnValue = cppValue;
79 {% endif %} 79 {% endif %}
80 return true; 80 return true;
81 } 81 }
82 82
83 {{cpp_class}}* NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolat e, v8::Local<v8::Value> value, ExceptionState& exceptionState) { 83 {{cpp_class}}* NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolat e, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
84 {{cpp_class}}* nativeValue = {{cpp_class}}::Create(ScriptState::Current(isolat e), value); 84 {{cpp_class}}* nativeValue = {{cpp_class}}::Create(ScriptState::Current(isolat e), value);
85 if (!nativeValue) 85 if (!nativeValue) {
86 exceptionState.ThrowTypeError("Unable to convert value to {{callback_functio n_name}}."); 86 exceptionState.ThrowTypeError(ExceptionMessages::FailedToConvertJSValue(
87 "{{callback_function_name}}"));
88 }
87 return nativeValue; 89 return nativeValue;
88 } 90 }
89 91
90 } // namespace blink 92 } // namespace blink
91 93
92 {% endfilter %}{# format_blink_cpp_source_code #} 94 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698