BotSharp/BotSharp.Core/Engines/Dialogflow/AIServiceException.cs
2018-07-12 10:07:05 -05:00

50 lines
1.1 KiB
C#

using BotSharp.Core.Models;
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.Core.Engines.Dialogflow
{
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;
}
}
}
}