Exemplo n.º 1
0
        /// <summary>
        /// Constructs an error from parameters.
        /// </summary>
        /// <param name="error">The GOLANG error string.</param>
        /// <param name="type">Optionally specifies the error type. This defaults to <see cref="TemporalErrorType.Generic"/>.</param>
        public TemporalError(string error, TemporalErrorType type = TemporalErrorType.Generic)
        {
            Covenant.Requires <ArgumentNullException>(!string.IsNullOrEmpty(error), nameof(error));

            this.String = error;
            this.SetErrorType(type);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Converts an <see cref="TemporalErrorType"/> into a error string.
        /// </summary>
        /// <param name="type">the error type.</param>
        /// <returns>The error string.</returns>
        internal static string ErrorTypeToString(TemporalErrorType type)
        {
            switch (type)
            {
            case TemporalErrorType.Cancelled:   return("cancelled");

            case TemporalErrorType.Custom:      return("custom");

            case TemporalErrorType.Generic:     return("generic");

            case TemporalErrorType.Panic:       return("panic");

            case TemporalErrorType.Terminated:  return("terminated");

            case TemporalErrorType.Timeout:     return("timeout");

            default:

                throw new NotImplementedException();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Sets the error type.
 /// </summary>
 /// <param name="type">The new type.</param>
 internal void SetErrorType(TemporalErrorType type)
 {
     Type = ErrorTypeToString(type);
 }