lauromoura pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=898ced96f68fbbc186617e54b9adf16f4eff5197
commit 898ced96f68fbbc186617e54b9adf16f4eff5197 Author: Bruno da Silva Belo <brunodasilvab...@gmail.com> Date: Mon Oct 28 11:59:52 2019 -0300 csharp: Add missing exception ctr from iwrapper. Summary: ref T8392 Reviewers: felipealmeida, lauromoura, segfaultxavi, YOhoho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8392 Differential Revision: https://phab.enlightenment.org/D10454 --- src/bindings/mono/eo_mono/iwrapper.cs | 93 ++++++++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 11 deletions(-) diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index d9ae4e56c5..8ba47b4aa8 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -573,7 +573,7 @@ public static class Globals } else { - tcs.TrySetException(new Efl.FutureException(received)); + tcs.TrySetException(new Efl.FutureException(err)); } } else @@ -1383,10 +1383,29 @@ public class StrbufKeepOwnershipMarshaler: ICustomMarshaler /// <summary>General exception for errors inside the binding.</summary> public class EflException : Exception { + /// <summary> + /// Default Constructor. + /// <para>Since EFL 1.23.</para> + /// </summary> + public EflException() + { + } + /// <summary>Create a new EflException with the given message.</summary> public EflException(string message) : base(message) { } + + /// <summary> + /// Create a new EflException with the given message and inner exception. + /// <para>Since EFL 1.23.</para> + /// </summary> + /// <param name="message">The message of the exception.</param> + /// <param name="innerException">The inner exception.</param> + public EflException(string message, Exception innerException) + : base(message, innerException) + { + } } /// <summary>Exception to be raised when a Task fails due to a failed Eina.Future.</summary> @@ -1395,18 +1414,70 @@ public class FutureException : EflException /// <summary>The error code returned by the failed Eina.Future.</summary> public Eina.Error Error { get; private set; } - /// <summary>Construct a new exception from the Eina.Error stored in the given Eina.Value.</summary> - public FutureException(Eina.Value value) : base("Future failed.") + /// <summary> + /// Default constructor. + /// <para>Since EFL 1.23.</para> + /// </summary> + public FutureException() : this(Eina.Error.UNHANDLED_EXCEPTION) { - if (value.GetValueType() != Eina.ValueType.Error) - { - throw new ArgumentException("FutureException must receive an Eina.Value with Eina.Error."); - } + } - Eina.Error err; - value.Get(out err); - Error = err; + /// <summary> + /// Construct a new exception from the <see cref="Eina.Error" /> + /// with a given message + /// <para>Since EFL 1.23.</para> + /// </summary> + /// <param name="message">The message of the exception.</param> + public FutureException(string message) + : this(Eina.Error.UNHANDLED_EXCEPTION, message) + { } -} + /// <summary> + /// Construct a new exception from the <see cref="Eina.Error" /> + /// with a given message and inner exception. + /// <para>Since EFL 1.23.</para> + /// </summary> + /// <param name="message">The message of the exception.</param> + /// <param name="innerException">The inner exception.</param> + public FutureException(string message, Exception innerException) + : this(Eina.Error.UNHANDLED_EXCEPTION, message, innerException) + { + } + + /// <summary> + /// Construct a new exception from the <see cref="Eina.Error" /> + /// with a given error. + /// <para>Since EFL 1.23.</para> + /// </summary> + /// <param name="error">The error of the exception..</param> + public FutureException(Eina.Error error) + : this(error, "Future failed.") + { + } + + /// <summary> + /// Construct a new exception from the <see cref="Eina.Error" /> + /// with a given error and message. + /// <para>Since EFL 1.23.</para> + /// </summary> + /// <param name="error">The error of the exception..</param> + /// <param name="message">The message of the exception.</param> + public FutureException(Eina.Error error, string message) + : this(error, message, null) + { + } + + /// <summary> + /// Construct a new exception from the <see cref="Eina.Error" /> + /// with a given error, message and innerException. + /// <para>Since EFL 1.23.</para> + /// </summary> + /// <param name="error">The error of the exception..</param> + /// <param name="message">The message of the exception.</param> + /// <param name="innerException">The inner exception.</param> + public FutureException(Eina.Error error, string message, + Exception innerException) + : base(message, innerException) => Error = error; +} } // namespace efl --