11import type { QwikElement , VirtualElement } from '../render/dom/virtual-element' ;
22import { isElement , isQwikElement } from '../util/element' ;
3- import { logErrorAndStop } from '../util/log' ;
3+ import { throwErrorAndStop } from '../util/log' ;
44import { qDev } from '../util/qdev' ;
55
66const ASSERT_DISCLAIMER = 'Internal assert, this is likely caused by a bug in Qwik: ' ;
@@ -14,7 +14,7 @@ export function assertDefined<T>(
1414 if ( value != null ) {
1515 return ;
1616 }
17- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
17+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
1818 }
1919}
2020
@@ -28,14 +28,14 @@ export function assertEqual(
2828 if ( value1 === value2 ) {
2929 return ;
3030 }
31- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
31+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
3232 }
3333}
3434
3535export function assertFail ( text : string , ...parts : any [ ] ) : never ;
3636export function assertFail ( text : string , ...parts : any [ ] ) {
3737 if ( qDev ) {
38- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
38+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
3939 }
4040}
4141
@@ -44,7 +44,7 @@ export function assertTrue(value1: any, text: string, ...parts: any[]): asserts
4444 if ( value1 === true ) {
4545 return ;
4646 }
47- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
47+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
4848 }
4949}
5050
@@ -53,7 +53,7 @@ export function assertNumber(value1: any, text: string, ...parts: any[]): assert
5353 if ( typeof value1 === 'number' ) {
5454 return ;
5555 }
56- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
56+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
5757 }
5858}
5959
@@ -62,15 +62,15 @@ export function assertString(value1: any, text: string, ...parts: any[]): assert
6262 if ( typeof value1 === 'string' ) {
6363 return ;
6464 }
65- throw logErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
65+ throwErrorAndStop ( ASSERT_DISCLAIMER + text , ...parts ) ;
6666 }
6767}
6868
6969export function assertQwikElement ( el : any ) : asserts el is QwikElement {
7070 if ( qDev ) {
7171 if ( ! isQwikElement ( el ) ) {
7272 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' ) ;
7474 }
7575 }
7676}
@@ -79,7 +79,7 @@ export function assertElement(el: Node | VirtualElement): asserts el is Element
7979 if ( qDev ) {
8080 if ( ! isElement ( el ) ) {
8181 console . error ( 'Not a Element, got' , el ) ;
82- throw logErrorAndStop ( ASSERT_DISCLAIMER + 'Not an Element' ) ;
82+ throwErrorAndStop ( ASSERT_DISCLAIMER + 'Not an Element' ) ;
8383 }
8484 }
8585}
0 commit comments