Page MenuHomePhabricator

efl_get_error
Open, TODOPublic

Description

Introduce new function efl_get_last_error();

efl_get_last_error : This function return last error occurred in the toolkit

One of the most annoying issues for new developers, when developer can not get the error, or what was done wrong, so he does not know If method failed, and even if it is failed, developer does not know exactly at which step things went wrong.

And Since a lot of functions in efl already return void, and we cannot change it or there parameters/
We can introduce efl_get_last_error(); which will return int error code value, which are well defined and user can handle them in the right way.

Example:

efl_evas_object_image_file_set(evas, file_name, Key);
If (efl_get_last_error() != EFL_NO_ERROR)
{
     //Handle the error in right way.
}

Extra Methods:

efl_get_last_error(); // return last error happened in the process;
efl_last_error_clear(); // clear last error happened in the process;
efl_error_occure(CALLBACK);// register callback when error occure;

Implementation wise:
1- First step could be modify Error macros like EINA_SAFETY to save error in global var, and return it in efl_get_last_error
2- This can be added step by step.

Related Objects

StatusAssignedTask
OpenNone
Openzmike
ali.alzyod added subscribers: woohyun, bu5hm4n, zmike and 4 others.

We can introduce efl_get_last_error(); which will return int error code value, which are well defined and user can handle them in the right way.

Given the failures of the c language here I support this approach. I would however ask you to elaborate on what errors should be reported by this.

Naming:
efl_last_error_clear() I would go rather with efl_clear_last_error

Also the name efl_error_occure doesn't seem right. First: spelling mistake: The last e is to much. But I think it should be occurred - because it already happened.

zmike closed this task as Resolved.Apr 30 2020, 6:23 AM
zmike claimed this task.

We already have this as eina_error_get(). It just isn't implemented or used widely.

In T8690#152105, @zmike wrote:

We already have this as eina_error_get(). It just isn't implemented or used widely.

Are you certain? The callback idea would add the possibility to callback async.

ProhtMeyhet reopened this task as Open.Apr 30 2020, 6:46 AM
ProhtMeyhet triaged this task as TODO priority.
In T8690#152105, @zmike wrote:

We already have this as eina_error_get(). It just isn't implemented or used widely.

Sorry, I know don't mess with an Admin and Core Developer, but I just looked at the code and this seems to be to try to be an improvement. And an RFC.