Page MenuHomePhabricator

efl-mono: Only raise exception for managed errors.
ClosedPublic

Authored by lauromoura on Thu, Jan 3, 12:23 PM.

Details

Summary

Previously, any unhandled Eina_Error would cause an exception
to be thrown when the control returned to C#.

This commit changes this behavior to only raise it when an exception
went unhandled from a C# callback back to C, like in an event handler,
for example.

Test Plan

run tests

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
lauromoura created this revision.Thu, Jan 3, 12:23 PM
lauromoura requested review of this revision.Thu, Jan 3, 12:23 PM

update examples to fix build error

Jaehyun_Cho accepted this revision.Fri, Jan 4, 12:17 AM

Thank you for this patch :) It looks fine to me.

I think this patch resolves C# abort from trivial eina_error_set() calls in C source code.

This revision is now accepted and ready to land.Fri, Jan 4, 12:17 AM

The change of meaning makes sense, from "Throw C# exception on any Eina error" to "Throw C# exception only when there are C# exceptions in C# callbacks".

Just a minor nitpick, I think the EFL_ERROR name is too generic and therefore does not convey any information. What does it really mean? An error in the bindings code? or in a C# user callback?
Maybe EFL_MONO_BINDINGS, EFL_INTERNAL, EFL_USER_CALLBACK... ?
Also, the word ERROR should not be part of the name (just like the other ones).

@lauromoura
What do you think about @segfaultxavi 's opinion?

@segfaultxavi
Thank you for comment :)
If EFL_ERROR should be modified, then how about modifying EFL_ERROR in a separate patch after submitting this patch?

I'm OK with doing it on a separate patch!

Update after changing from Eina.Error.EFL_ERROR to Eina.Error.UNHANDLED_EXCEPTION

Also merged changes to build examples.

Jaehyun_Cho accepted this revision.Tue, Jan 15, 12:50 AM

@lauromoura
Thank you for the patch :)

This revision was automatically updated to reflect the committed changes.

This is still making "make check" fail, please @lauromoura don't forget to update all affected files!

$ find -name "*.cs" | xargs grep RaiseIfOccurred
./src/examples/efl_mono/example_numberwrapper.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/examples/efl_mono/example_numberwrapper.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/examples/efl_mono/example_numberwrapper.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/examples/efl_mono/example_numberwrapper.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/examples/efl_mono/example_numberwrapper.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/examples/efl_mono/example_numberwrapper.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/elementary/efl_selection.eo.cs:         Eina.Error.RaiseIfOccurred();
./src/lib/elementary/efl_selection.eo.cs:         Eina.Error.RaiseIfOccurred();
./src/lib/elementary/efl_selection.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/elementary/efl_selection.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/elementary/efl_selection.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/elementary/efl_selection.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/elementary/efl_ui_translatable.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/elementary/efl_ui_translatable.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/elementary/efl_ui_translatable.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/elementary/efl_selection_types.eot.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/efl/interfaces/efl_ui_base.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/efl/interfaces/efl_ui_base.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/efl/interfaces/efl_ui_base.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/efl/interfaces/efl_ui_base.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/efl/interfaces/efl_ui_base.eo.cs:      Eina.Error.RaiseIfOccurred();
./src/lib/efl/interfaces/efl_ui_base.eo.cs:      Eina.Error.RaiseIfOccurred();
$ find -name "*.cs" | xargs grep EFL_ERROR
./src/examples/efl_mono/example_numberwrapper.eo.cs:         Eina.Error.Set(Eina.Error.EFL_ERROR);
./src/examples/efl_mono/example_numberwrapper.eo.cs:            Eina.Error.Set(Eina.Error.EFL_ERROR);
./src/examples/efl_mono/example_numberwrapper.eo.cs:            Eina.Error.Set(Eina.Error.EFL_ERROR);
./src/examples/efl_mono/example_numberwrapper.eo.cs:            Eina.Error.Set(Eina.Error.EFL_ERROR);
./src/examples/efl_mono/example_numberwrapper.eo.cs:            Eina.Error.Set(Eina.Error.EFL_ERROR);
./src/examples/efl_mono/example_numberwrapper.eo.cs:            Eina.Error.Set(Eina.Error.EFL_ERROR);
./src/lib/elementary/efl_selection.eo.cs:         Eina.Error.Set(Eina.Error.EFL_ERROR);
./src/lib/elementary/efl_selection_types.eot.cs:         Eina.Error.Set(Eina.Error.EFL_ERROR);

I now realize all the obsolete references are in generated files, so this is probably a case of old files not being regenerated properly due to bad dependency checking. I am so sorry.