Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute the formatting code, but the error cannot be caught using try catch #361

Open
colindcli opened this issue May 19, 2023 · 1 comment

Comments

@colindcli
Copy link

The code.zip compressed package contains a js test file. When using the above code var setting = CodeSettings.Pretty(); Uglify.Js(code, setting); to format js, an error is reported. The error message is $exception {"Exception_WasThrown"} System.StackOverflowException I use try catch, but the error cannot be caught, and the program crashes directly.

code.zip

try{
    var setting = CodeSettings.Pretty(); 
    //Use the js file in the code.zip compressed package 
    Uglify.Js(code, setting);
} catch(Exception e){
    //but can't catch the error
}

The main problem is that the catch cannot catch the error

Originally posted by @colindcli in #355 (comment)

code.zip

code.zip contains a js file, because the file is too large, please decompress it locally.

// read js file code
var code = System.IO.File.ReadAllText("code.js");

try
{
	var setting = CodeSettings.Pretty();
	Uglify.Js(code, setting);
}
catch (Exception e)
{
	//but can't catch the error
}

Executing formatting will report an error. It doesn’t matter if the error is reported, but the error cannot be caught

@colindcli
Copy link
Author

Don't rush to close it if it can't be solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant