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

verify errors are not colorized #7

Closed
zwetan opened this issue Sep 29, 2017 · 4 comments
Closed

verify errors are not colorized #7

zwetan opened this issue Sep 29, 2017 · 4 comments
Milestone

Comments

@zwetan
Copy link
Member

zwetan commented Sep 29, 2017

When a script dynamically load definitions

for example

#!/usr/bin/env as3shebang -el -ec

import shell.*;

var person_loaded:Boolean = Runtime.load( "Person.swf" );
trace( "Person loaded: " + person_loaded );

import test.as3examples.*;

var p1:Person = new Person( "John Doe", 21 );
trace( "p1 = " + p1 );

because the definition is in "Person.swf"

the line

var p1:Person = new Person( "John Doe", 21 );

will generate a VerifyError

@zwetan zwetan added this to the 1.1.0 milestone Sep 29, 2017
@zwetan
Copy link
Member Author

zwetan commented Sep 29, 2017

verify_error1

@zwetan
Copy link
Member Author

zwetan commented Sep 29, 2017

Not only we want to catch this error but we also want to colorize it like other errors.

for ex
verify_error2

but here the problems

  • the error occurs outside the script scope
  • a try/catch around Runtime.eval() can not catch such errors

@zwetan
Copy link
Member Author

zwetan commented Sep 29, 2017

a try/catch around Runtime.eval() can not catch such errors
because what happen internally is that the C++ already does a try/catch
and if an error is found it then stringify it to the script output.

by replacing Runtime.eval() with Runtime.returnEval()
we can return the output of the script into a string
and then we can test for some strings to check if a VerifyError occured

then we can format the output as if it was an internal script error

@zwetan
Copy link
Member Author

zwetan commented Sep 29, 2017

Here the result
verify_error3

we do catch the error
but we remove the stacktrace (as it is not related to the script)
we apply options if they are enabled
etc.

other example with DEBUG enabled
verify_error4

@zwetan zwetan closed this as completed Sep 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant