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

Unified Diff: Source/modules/webaudio/AnalyserNode.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 | « LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AnalyserNode.cpp
diff --git a/Source/modules/webaudio/AnalyserNode.cpp b/Source/modules/webaudio/AnalyserNode.cpp
index 128840ef9b0e2787c49a12668f9f3992613f2fc4..e8383019ab719c79e6f7178c29562e74e6c27bec 100644
--- a/Source/modules/webaudio/AnalyserNode.cpp
+++ b/Source/modules/webaudio/AnalyserNode.cpp
@@ -28,6 +28,7 @@
#include "modules/webaudio/AnalyserNode.h"
+#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
#include "modules/webaudio/AudioNodeInput.h"
@@ -75,8 +76,17 @@ void AnalyserNode::reset()
void AnalyserNode::setFftSize(unsigned size, ExceptionState& es)
{
- if (!m_analyser.setFftSize(size))
- es.throwUninformativeAndGenericDOMException(NotSupportedError);
+ if (!m_analyser.setFftSize(size)) {
+ es.throwDOMException(
+ NotSupportedError,
+ ExceptionMessages::failedToSet(
+ "fftSize",
+ "AnalyserNode",
+ "FFT size (" + String::number(size)
+ + ") must be a power of two between "
+ + String::number(RealtimeAnalyser::MinFFTSize) + " and "
+ + String::number(RealtimeAnalyser::MaxFFTSize) + ", inclusive"));
+ }
}
} // namespace WebCore
« no previous file with comments | « LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698