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

Unified Diff: Source/modules/webaudio/WaveShaperNode.cpp

Issue 24877002: Add more informative messages for DOM exceptions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Upload again Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/webaudio/OfflineAudioContext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/WaveShaperNode.cpp
diff --git a/Source/modules/webaudio/WaveShaperNode.cpp b/Source/modules/webaudio/WaveShaperNode.cpp
index c4d4c9bb1d2f3763a94c77a8217ca54dbb718994..7e2064597ebda8ed3a8ea3b3a3f0228ca99127a4 100644
--- a/Source/modules/webaudio/WaveShaperNode.cpp
+++ b/Source/modules/webaudio/WaveShaperNode.cpp
@@ -28,6 +28,7 @@
#include "modules/webaudio/WaveShaperNode.h"
+#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
#include "wtf/MainThread.h"
@@ -64,14 +65,20 @@ void WaveShaperNode::setOversample(const String& type, ExceptionState& es)
// initialize() and uninitialize().
AudioContext::AutoLocker contextLocker(context());
- if (type == "none")
+ if (type == "none") {
waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSampleNone);
- else if (type == "2x")
+ } else if (type == "2x") {
waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample2x);
- else if (type == "4x")
+ } else if (type == "4x") {
waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample4x);
- else
- es.throwUninformativeAndGenericDOMException(InvalidStateError);
+ } else {
+ es.throwDOMException(
+ InvalidStateError,
+ ExceptionMessages::failedToSet(
+ "oversample",
+ "WaveShaperNode",
+ "invalid oversample '" + type + "': must be 'none', '2x', or '4x'."));
+ }
}
String WaveShaperNode::oversample() const
« no previous file with comments | « Source/modules/webaudio/OfflineAudioContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698