Allow FromError(Exception) on all IResult types.

This commit is contained in:
Joe4evr
2018-08-09 02:20:36 +02:00
committed by Finite Reality
parent 2c3e9193c2
commit 748e92bcda
5 changed files with 18 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Discord.Commands
@@ -53,6 +54,8 @@ namespace Discord.Commands
public static ParseResult FromError(CommandError error, string reason)
=> new ParseResult(null, null, error, reason);
public static ParseResult FromError(Exception ex)
=> FromError(CommandError.Exception, ex.Message);
public static ParseResult FromError(IResult result)
=> new ParseResult(null, null, result.Error, result.ErrorReason);