Skip to content

Commit a782edf

Browse files
committed
Only create origin stacktrace for tagged and debug - fixes porsager#290
1 parent 9068820 commit a782edf

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/query.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ export class Query extends Promise {
3131
this.executed = false
3232
this.signature = ''
3333

34-
this[originError] = handler.debug || !this.tagged
34+
this[originError] = this.handler.debug
3535
? new Error()
36-
: cachedError(this.strings)
36+
: this.tagged && cachedError(this.strings)
3737
}
3838

3939
get origin() {
40-
return this.handler.debug || !this.tagged
40+
return this.handler.debug
4141
? this[originError].stack
42-
: originStackCache.has(this.strings)
43-
? originStackCache.get(this.strings)
44-
: originStackCache.set(this.strings, this[originError].stack).get(this.strings)
42+
: this.tagged
43+
? originStackCache.has(this.strings)
44+
? originStackCache.get(this.strings)
45+
: originStackCache.set(this.strings, this[originError].stack).get(this.strings)
46+
: ''
4547
}
4648

4749
static get [Symbol.species]() {

0 commit comments

Comments
 (0)