avm1: Don't log errors at every Activation, only at the "root" frames
This commit is contained in:
parent
8218e14824
commit
3ee1902117
|
@ -384,13 +384,16 @@ pub fn root_error_handler<'gc>(
|
||||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||||
error: Error<'gc>,
|
error: Error<'gc>,
|
||||||
) {
|
) {
|
||||||
if let Error::ThrownValue(error) = error {
|
if let Error::ThrownValue(error) = &error {
|
||||||
let string = error
|
let string = error
|
||||||
.coerce_to_string(activation, context)
|
.coerce_to_string(activation, context)
|
||||||
.unwrap_or_else(|_| Cow::Borrowed("undefined"));
|
.unwrap_or_else(|_| Cow::Borrowed("undefined"));
|
||||||
log::info!(target: "avm_trace", "{}", string);
|
log::info!(target: "avm_trace", "{}", string);
|
||||||
} else {
|
} else {
|
||||||
log::error!("Uncaught error: {:?}", error);
|
log::error!("{}", error);
|
||||||
|
}
|
||||||
|
if error.is_halting() {
|
||||||
|
activation.avm.halt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -386,7 +386,7 @@ impl<'a, 'gc: 'a> Activation<'a, 'gc> {
|
||||||
} else if let Some(action) = reader.read_action()? {
|
} else if let Some(action) = reader.read_action()? {
|
||||||
avm_debug!("({}) Action: {:?}", self.id.depth(), action);
|
avm_debug!("({}) Action: {:?}", self.id.depth(), action);
|
||||||
|
|
||||||
let result = match action {
|
match action {
|
||||||
Action::Add => self.action_add(context),
|
Action::Add => self.action_add(context),
|
||||||
Action::Add2 => self.action_add_2(context),
|
Action::Add2 => self.action_add_2(context),
|
||||||
Action::And => self.action_and(context),
|
Action::And => self.action_and(context),
|
||||||
|
@ -516,18 +516,7 @@ impl<'a, 'gc: 'a> Activation<'a, 'gc> {
|
||||||
Action::Throw => self.action_throw(context),
|
Action::Throw => self.action_throw(context),
|
||||||
Action::Try(try_block) => self.action_try(context, &try_block, &data),
|
Action::Try(try_block) => self.action_try(context, &try_block, &data),
|
||||||
_ => self.unknown_op(context, action),
|
_ => self.unknown_op(context, action),
|
||||||
};
|
|
||||||
if let Err(e) = result {
|
|
||||||
match &e {
|
|
||||||
Error::ThrownValue(_) => {}
|
|
||||||
e => log::error!("AVM1 error: {}", e),
|
|
||||||
}
|
|
||||||
if e.is_halting() {
|
|
||||||
self.avm.halt();
|
|
||||||
}
|
|
||||||
return Err(e);
|
|
||||||
}
|
}
|
||||||
result
|
|
||||||
} else {
|
} else {
|
||||||
//The explicit end opcode was encountered so return here
|
//The explicit end opcode was encountered so return here
|
||||||
Ok(FrameControl::Return(ReturnType::Implicit))
|
Ok(FrameControl::Return(ReturnType::Implicit))
|
||||||
|
|
Loading…
Reference in New Issue