BotSharp/Platform.Dialogflow/Models/AIServiceException.cs
2018-10-02 20:44:11 -05:00

49 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace Platform.Dialogflow.Models
{
public class AIServiceException : Exception
{
public AIResponse Response { get; set; }
public AIServiceException()
{
}
public AIServiceException(string message) : base(message)
{
}
public AIServiceException(string message, Exception innerException) : base(message, innerException)
{
}
public AIServiceException(Exception e) : base(e.Message, e)
{
}
public AIServiceException(AIResponse response)
{
Response = response;
}
public override string Message
{
get
{
if (Response != null && Response.IsError)
{
if (!string.IsNullOrEmpty(Response.Status.ErrorDetails))
{
return Response.Status.ErrorDetails;
}
}
return base.Message;
}
}
}
}