aboutsummaryrefslogtreecommitdiffstats
path: root/src/html/xmlhttprequest.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/html/xmlhttprequest.nim')
-rw-r--r--src/html/xmlhttprequest.nim5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/html/xmlhttprequest.nim b/src/html/xmlhttprequest.nim
index 6e6ca940..5f85aee6 100644
--- a/src/html/xmlhttprequest.nim
+++ b/src/html/xmlhttprequest.nim
@@ -382,9 +382,8 @@ func getCharset(this: XMLHttpRequest): Charset =
proc responseText(ctx: JSContext; this: XMLHttpRequest): JSValue {.jsfget.} =
if this.responseType notin {xhrtUnknown, xhrtText}:
- let ex = newDOMException("response type was expected to be '' or 'text'",
- "InvalidStateError")
- return JS_Throw(ctx, ctx.toJS(ex))
+ return JS_ThrowDOMException(ctx,
+ "Response type was expected to be '' or 'text'", "InvalidStateError")
if this.readyState notin {xhrsLoading, xhrsDone}:
return ctx.toJS("")
let charset = this.getCharset()