convert also AssertErrors to WasmExceptions

This commit is contained in:
Volker Berlin 2022-06-06 15:37:12 +02:00
parent 442e0c896c
commit 4958cb2f46
No known key found for this signature in database
GPG Key ID: 988423EF815BE4CB
5 changed files with 10 additions and 10 deletions

View File

@ -98,7 +98,7 @@ class JavaMethodWasmCodeBuilder extends WasmCodeBuilder {
AnyType returnType = new ValueTypeParser( method.getType().substring( method.getType().lastIndexOf( ')' ) + 1), getTypeManager() ).next();
writeCode( byteCode, code.getConstantPool(), method.getDeclaringClassFile(), returnType );
calculateVariables();
} catch( Exception ioex ) {
} catch( Throwable ioex ) {
int lineNumber = byteCode == null ? -1 : byteCode.getLineNumber();
throw WasmException.create( ioex, lineNumber );
}
@ -763,7 +763,7 @@ class JavaMethodWasmCodeBuilder extends WasmCodeBuilder {
patchTypeOfNullConst();
}
} catch( Exception ex ) {
} catch( Throwable ex ) {
throw WasmException.create( ex, lineNumber );
}
}
@ -988,7 +988,7 @@ class JavaMethodWasmCodeBuilder extends WasmCodeBuilder {
}
}
}
} catch( Exception ex ) {
} catch( Throwable ex ) {
throw WasmException.create( ex, instr.getLineNumber() );
}
}

View File

@ -485,7 +485,7 @@ public class ModuleGenerator {
for( MethodInfo method : methods ) {
handler.accept( method );
}
} catch( IOException ioex ) {
} catch( Throwable ioex ) {
throw WasmException.create( ioex, sourceFile, className, methodName, -1 );
}
}
@ -526,7 +526,7 @@ public class ModuleGenerator {
functions.markAsExport( name, annotationValues );
return;
}
} catch( Exception ioex ) {
} catch( Throwable ioex ) {
throw WasmException.create( ioex, sourceFile, className, methodName, -1 );
}
}
@ -604,7 +604,7 @@ public class ModuleGenerator {
}
throw new WasmException( "Abstract or native method can not be used: " + name.signatureName +"\nIf you want to use classes with native code, you must use a library that implements these native methods, such as 'de.inetsoftware:jwebassembly-api:+'.", -1 );
}
} catch( Exception ioex ) {
} catch( Throwable ioex ) {
int lineNumber = code == null ? -1 : code.getFirstLineNr();
throw WasmException.create( ioex, sourceFile, className, methodName, lineNumber );
}

View File

@ -197,7 +197,7 @@ class StaticCodeBuilder {
state.dependenciesClasses.add( otherClassName );
}
}
} catch( IOException ex ) {
} catch( Throwable ex ) {
throw WasmException.create( ex, sourceFile, className, name.methodName, instr == null ? -1 : instr.getLineNumber() );
}
return state;

View File

@ -553,7 +553,7 @@ public abstract class WasmCodeBuilder {
FieldInfo field = classFile.getField( name.methodName );
AnyType type = new ValueTypeParser( field.getType(), types ).next();
addGlobalInstruction( load, name, type, null, javaCodePos, lineNumber );
} catch( Exception ex ) {
} catch( Throwable ex ) {
throw WasmException.create( ex, lineNumber );
}
}
@ -865,7 +865,7 @@ public abstract class WasmCodeBuilder {
return new FunctionName( method );
}
}
} catch( IOException ex ) {
} catch( Throwable ex ) {
throw WasmException.create( ex, lineNumber );
}
throw new WasmException( "Not implemented NonGC polyfill function: " + name, lineNumber );

View File

@ -330,7 +330,7 @@ public class WatParser extends WasmCodeBuilder {
throw new WasmException( "Unknown WASM token: " + tok, lineNumber );
}
}
} catch( Exception ex ) {
} catch( Throwable ex ) {
throw WasmException.create( ex, lineNumber );
}
}