avm2: Remove `From<Box<dyn std::error::Error>> for Error<'gc>`
This commit is contained in:
parent
cc531ff7db
commit
65ecb4fe8f
|
@ -691,7 +691,7 @@ fn attach_movie<'gc>(
|
|||
.context
|
||||
.library
|
||||
.library_for_movie(movie_clip.movie().unwrap())
|
||||
.ok_or_else(|| "Movie is missing!".into())
|
||||
.ok_or("Movie is missing!")
|
||||
.and_then(|l| l.instantiate_by_export_name(export_name, activation.context.gc_context))
|
||||
{
|
||||
// Set name and attach to parent.
|
||||
|
@ -860,7 +860,7 @@ pub fn duplicate_movie_clip_with_bias<'gc>(
|
|||
.context
|
||||
.library
|
||||
.library_for_movie(movie)
|
||||
.ok_or_else(|| "Movie is missing!".into())
|
||||
.ok_or("Movie is missing!")
|
||||
.and_then(|l| l.instantiate_by_id(id, activation.context.gc_context))
|
||||
} else {
|
||||
// Dynamically created clip; create a new empty movie clip.
|
||||
|
|
|
@ -131,9 +131,3 @@ impl<'gc> From<String> for Error<'gc> {
|
|||
Error::RustError(val.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gc> From<Box<dyn std::error::Error>> for Error<'gc> {
|
||||
fn from(val: Box<dyn std::error::Error>) -> Error<'gc> {
|
||||
Error::RustError(val)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,12 +165,12 @@ impl<'gc> MovieLibrary<'gc> {
|
|||
&self,
|
||||
id: CharacterId,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
) -> Result<DisplayObject<'gc>, Box<dyn std::error::Error>> {
|
||||
) -> Result<DisplayObject<'gc>, &'static str> {
|
||||
if let Some(character) = self.characters.get(&id) {
|
||||
self.instantiate_display_object(character, gc_context)
|
||||
} else {
|
||||
log::error!("Tried to instantiate non-registered character ID {}", id);
|
||||
Err("Character id doesn't exist".into())
|
||||
Err("Character id doesn't exist")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ impl<'gc> MovieLibrary<'gc> {
|
|||
&self,
|
||||
export_name: AvmString<'gc>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
) -> Result<DisplayObject<'gc>, Box<dyn std::error::Error>> {
|
||||
) -> Result<DisplayObject<'gc>, &'static str> {
|
||||
if let Some(character) = self.export_characters.get(export_name, false) {
|
||||
self.instantiate_display_object(character, gc_context)
|
||||
} else {
|
||||
|
@ -188,7 +188,7 @@ impl<'gc> MovieLibrary<'gc> {
|
|||
"Tried to instantiate non-registered character {}",
|
||||
export_name
|
||||
);
|
||||
Err("Character id doesn't exist".into())
|
||||
Err("Character id doesn't exist")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ impl<'gc> MovieLibrary<'gc> {
|
|||
&self,
|
||||
character: &Character<'gc>,
|
||||
gc_context: MutationContext<'gc, '_>,
|
||||
) -> Result<DisplayObject<'gc>, Box<dyn std::error::Error>> {
|
||||
) -> Result<DisplayObject<'gc>, &'static str> {
|
||||
match character {
|
||||
Character::Bitmap(bitmap) => Ok(bitmap.instantiate(gc_context)),
|
||||
Character::EditText(edit_text) => Ok(edit_text.instantiate(gc_context)),
|
||||
|
@ -209,7 +209,7 @@ impl<'gc> MovieLibrary<'gc> {
|
|||
Character::Avm2Button(button) => Ok(button.instantiate(gc_context)),
|
||||
Character::Text(text) => Ok(text.instantiate(gc_context)),
|
||||
Character::Video(video) => Ok(video.instantiate(gc_context)),
|
||||
_ => Err("Not a DisplayObject".into()),
|
||||
_ => Err("Not a DisplayObject"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue