@@ -18,7 +18,7 @@ import {
1818} from 'pyodide-internal:metadata' ;
1919import {
2020 invalidateCaches ,
21- PythonRuntimeError ,
21+ PythonWorkersInternalError ,
2222 PythonUserError ,
2323 simpleRunPython ,
2424} from 'pyodide-internal:util' ;
@@ -237,7 +237,7 @@ function getMemoryPatched(
237237 if ( expectedTableBase && tableBase !== expectedTableBase ) {
238238 // If this happens, we will segfault if we ever try to use this dynamic library.
239239 // Save ourselves some debugging pain by crashing early.
240- throw new PythonRuntimeError (
240+ throw new PythonWorkersInternalError (
241241 `Error loading ${ libName } : Expected table base ${ expectedTableBase } but got table base ${ tableBase } `
242242 ) ;
243243 }
@@ -302,7 +302,7 @@ function loadDynlibFromVendor(
302302 const path = soFile . slice ( 3 ) . join ( '/' ) ;
303303 const index = userBundleNames . indexOf ( path ) ;
304304 if ( index == - 1 ) {
305- throw new PythonRuntimeError (
305+ throw new PythonWorkersInternalError (
306306 `Could not find ${ path } in user bundle, which is required by the snapshot.`
307307 ) ;
308308 }
@@ -618,14 +618,14 @@ function decodeSnapshot(
618618 return undefined ;
619619 }
620620 if ( reader . getMemorySnapshotSize ( ) === 0 ) {
621- throw new PythonRuntimeError (
621+ throw new PythonWorkersInternalError (
622622 `SnapshotReader returned memory snapshot size of 0`
623623 ) ;
624624 }
625625 const header = new Uint32Array ( 4 ) ;
626626 reader . readMemorySnapshot ( 0 , header ) ;
627627 if ( header [ 0 ] !== SNAPSHOT_MAGIC ) {
628- throw new PythonRuntimeError (
628+ throw new PythonWorkersInternalError (
629629 `Invalid magic number ${ header [ 0 ] } , expected ${ SNAPSHOT_MAGIC } `
630630 ) ;
631631 }
@@ -686,7 +686,7 @@ function checkSnapshotType(snapshotType: string): void {
686686 snapshotType === 'dedicated' &&
687687 ! IS_DEDICATED_SNAPSHOT_ENABLED
688688 ) {
689- throw new PythonRuntimeError (
689+ throw new PythonWorkersInternalError (
690690 'Received dedicated snapshot but compat flag for dedicated snapshots is not enabled'
691691 ) ;
692692 }
@@ -696,7 +696,7 @@ function checkSnapshotType(snapshotType: string): void {
696696 snapshotType !== 'dedicated' &&
697697 IS_DEDICATED_SNAPSHOT_ENABLED
698698 ) {
699- throw new PythonRuntimeError (
699+ throw new PythonWorkersInternalError (
700700 'Received non-dedicated snapshot but compat flag for dedicated snapshots is enabled'
701701 ) ;
702702 }
@@ -705,7 +705,7 @@ function checkSnapshotType(snapshotType: string): void {
705705 // should verify that the snapshot in the bundle is a dedicated snapshot. If it is not
706706 // we should fail with an error.
707707 if ( snapshotType !== 'dedicated' && IS_SECOND_VALIDATION_PHASE ) {
708- throw new PythonRuntimeError (
708+ throw new PythonWorkersInternalError (
709709 'The second validation phase should receive a dedicated snapshot, got ' +
710710 snapshotType
711711 ) ;
@@ -766,7 +766,7 @@ function collectSnapshot(
766766 ) ;
767767 DiskCache . put ( 'snapshot.bin' , snapshot ) ;
768768 } else {
769- throw new PythonRuntimeError (
769+ throw new PythonWorkersInternalError (
770770 "Attempted to collect snapshot outside of context where it's supported."
771771 ) ;
772772 }
@@ -791,13 +791,13 @@ export function maybeCollectDedicatedSnapshot(
791791 if ( Module . API . version == '0.26.0a2' ) {
792792 // 0.26.0a2 does not support serialisation of the hiwire state, so it cannot support dedicated
793793 // snapshots.
794- throw new PythonRuntimeError (
794+ throw new PythonWorkersInternalError (
795795 'Dedicated snapshot is not supported for Python runtime version 0.26.0a2'
796796 ) ;
797797 }
798798
799799 if ( ! pyodide_entrypoint_helper ) {
800- throw new PythonRuntimeError (
800+ throw new PythonWorkersInternalError (
801801 'pyodide_entrypoint_helper is required for dedicated snapshot'
802802 ) ;
803803 }
@@ -840,7 +840,7 @@ export function finalizeBootstrap(
840840 if ( 'pyodide_entrypoint_helper' in obj ) {
841841 return pyodide_entrypoint_helper ;
842842 }
843- throw new PythonRuntimeError ( `Can't deserialize ${ obj } ` ) ;
843+ throw new PythonWorkersInternalError ( `Can't deserialize ${ obj } ` ) ;
844844 } ;
845845
846846 Module . API . config . _makeSnapshot =
0 commit comments