Skip to content

Commit b17053b

Browse files
committed
avm2: Stub for Error.getErrorMessage
1 parent a965029 commit b17053b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

core/src/avm2/globals/Error.as

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ package {
1111
};
1212
}
1313

14+
public static native function getErrorMessage(id:int):String;
15+
1416
[Ruffle(NativeAccessible)]
1517
public var name:String = "Error";
1618

core/src/avm2/globals/error.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
use crate::avm2::activation::Activation;
22
pub use crate::avm2::object::error_allocator;
3+
use crate::avm2::parameters::ParametersExt;
34
use crate::avm2::string::AvmString;
45
use crate::avm2::value::Value;
56
use crate::avm2::Error;
6-
use crate::PlayerMode;
7+
use crate::{avm2_stub_method, PlayerMode};
8+
9+
pub fn get_error_message<'gc>(
10+
activation: &mut Activation<'_, 'gc>,
11+
_this: Value<'gc>,
12+
args: &[Value<'gc>],
13+
) -> Result<Value<'gc>, Error<'gc>> {
14+
avm2_stub_method!(activation, "Error", "getErrorMessage");
15+
16+
let id = args.get_i32(0);
17+
let message = format!("Error #{id}");
18+
Ok(AvmString::new_utf8(activation.gc(), message).into())
19+
}
720

821
pub fn get_stack_trace<'gc>(
922
activation: &mut Activation<'_, 'gc>,

0 commit comments

Comments
 (0)