1
1
import type { QwikElement , VirtualElement } from '../render/dom/virtual-element' ;
2
2
import { isElement , isQwikElement } from '../util/element' ;
3
- import { logErrorAndStop } from '../util/log' ;
3
+ import { throwErrorAndStop } from '../util/log' ;
4
4
import { qDev } from '../util/qdev' ;
5
5
6
6
const ASSERT_DISCLAIMER = 'Internal assert, this is likely caused by a bug in Qwik: ' ;
@@ -14,7 +14,7 @@ export function assertDefined<T>(
14
14
if ( value != null ) {
15
15
return ;
16
16
}
17
- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
17
+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
18
18
}
19
19
}
20
20
@@ -28,14 +28,14 @@ export function assertEqual(
28
28
if ( value1 === value2 ) {
29
29
return ;
30
30
}
31
- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
31
+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
32
32
}
33
33
}
34
34
35
35
export function assertFail ( text : string , ...parts : any [ ] ) : never ;
36
36
export function assertFail ( text : string , ...parts : any [ ] ) {
37
37
if ( qDev ) {
38
- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
38
+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
39
39
}
40
40
}
41
41
@@ -44,7 +44,7 @@ export function assertTrue(value1: any, text: string, ...parts: any[]): asserts
44
44
if ( value1 === true ) {
45
45
return ;
46
46
}
47
- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
47
+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
48
48
}
49
49
}
50
50
@@ -53,7 +53,7 @@ export function assertNumber(value1: any, text: string, ...parts: any[]): assert
53
53
if ( typeof value1 === 'number' ) {
54
54
return ;
55
55
}
56
- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
56
+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
57
57
}
58
58
}
59
59
@@ -62,15 +62,15 @@ export function assertString(value1: any, text: string, ...parts: any[]): assert
62
62
if ( typeof value1 === 'string' ) {
63
63
return ;
64
64
}
65
- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
65
+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
66
66
}
67
67
}
68
68
69
69
export function assertQwikElement ( el : any ) : asserts el is QwikElement {
70
70
if ( qDev ) {
71
71
if ( ! isQwikElement ( el ) ) {
72
72
console . error ( 'Not a Qwik Element, got' , el ) ;
73
- throw logErrorAndStop ( ASSERT_DISCLAIMER + 'Not a Qwik Element' ) ;
73
+ throwErrorAndStop ( ASSERT_DISCLAIMER + 'Not a Qwik Element' ) ;
74
74
}
75
75
}
76
76
}
@@ -79,7 +79,7 @@ export function assertElement(el: Node | VirtualElement): asserts el is Element
79
79
if ( qDev ) {
80
80
if ( ! isElement ( el ) ) {
81
81
console . error ( 'Not a Element, got' , el ) ;
82
- throw logErrorAndStop ( ASSERT_DISCLAIMER + 'Not an Element' ) ;
82
+ throwErrorAndStop ( ASSERT_DISCLAIMER + 'Not an Element' ) ;
83
83
}
84
84
}
85
85
}
0 commit comments