| @@ -1,4 +1,5 @@ | |||||
| using System.Collections.Generic; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| namespace Discord.Commands | namespace Discord.Commands | ||||
| @@ -53,6 +54,8 @@ namespace Discord.Commands | |||||
| public static ParseResult FromError(CommandError error, string reason) | public static ParseResult FromError(CommandError error, string reason) | ||||
| => new ParseResult(null, null, error, reason); | => new ParseResult(null, null, error, reason); | ||||
| public static ParseResult FromError(Exception ex) | |||||
| => FromError(CommandError.Exception, ex.Message); | |||||
| public static ParseResult FromError(IResult result) | public static ParseResult FromError(IResult result) | ||||
| => new ParseResult(null, null, result.Error, result.ErrorReason); | => new ParseResult(null, null, result.Error, result.ErrorReason); | ||||
| @@ -1,4 +1,5 @@ | |||||
| using System.Collections.Generic; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| namespace Discord.Commands | namespace Discord.Commands | ||||
| @@ -18,6 +19,8 @@ namespace Discord.Commands | |||||
| => new PreconditionGroupResult(null, null, null); | => new PreconditionGroupResult(null, null, null); | ||||
| public static PreconditionGroupResult FromError(string reason, ICollection<PreconditionResult> preconditions) | public static PreconditionGroupResult FromError(string reason, ICollection<PreconditionResult> preconditions) | ||||
| => new PreconditionGroupResult(CommandError.UnmetPrecondition, reason, preconditions); | => new PreconditionGroupResult(CommandError.UnmetPrecondition, reason, preconditions); | ||||
| public static new PreconditionGroupResult FromError(Exception ex) | |||||
| => new PreconditionGroupResult(CommandError.Exception, ex.Message, null); | |||||
| public static new PreconditionGroupResult FromError(IResult result) //needed? | public static new PreconditionGroupResult FromError(IResult result) //needed? | ||||
| => new PreconditionGroupResult(result.Error, result.ErrorReason, null); | => new PreconditionGroupResult(result.Error, result.ErrorReason, null); | ||||
| @@ -1,4 +1,5 @@ | |||||
| using System.Diagnostics; | |||||
| using System; | |||||
| using System.Diagnostics; | |||||
| namespace Discord.Commands | namespace Discord.Commands | ||||
| { | { | ||||
| @@ -20,6 +21,8 @@ namespace Discord.Commands | |||||
| => new PreconditionResult(null, null); | => new PreconditionResult(null, null); | ||||
| public static PreconditionResult FromError(string reason) | public static PreconditionResult FromError(string reason) | ||||
| => new PreconditionResult(CommandError.UnmetPrecondition, reason); | => new PreconditionResult(CommandError.UnmetPrecondition, reason); | ||||
| public static PreconditionResult FromError(Exception ex) | |||||
| => new PreconditionResult(CommandError.Exception, ex.Message); | |||||
| public static PreconditionResult FromError(IResult result) | public static PreconditionResult FromError(IResult result) | ||||
| => new PreconditionResult(result.Error, result.ErrorReason); | => new PreconditionResult(result.Error, result.ErrorReason); | ||||
| @@ -1,4 +1,5 @@ | |||||
| using System.Collections.Generic; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| namespace Discord.Commands | namespace Discord.Commands | ||||
| @@ -26,6 +27,8 @@ namespace Discord.Commands | |||||
| => new SearchResult(text, commands, null, null); | => new SearchResult(text, commands, null, null); | ||||
| public static SearchResult FromError(CommandError error, string reason) | public static SearchResult FromError(CommandError error, string reason) | ||||
| => new SearchResult(null, null, error, reason); | => new SearchResult(null, null, error, reason); | ||||
| public static SearchResult FromError(Exception ex) | |||||
| => FromError(CommandError.Exception, ex.Message); | |||||
| public static SearchResult FromError(IResult result) | public static SearchResult FromError(IResult result) | ||||
| => new SearchResult(null, null, result.Error, result.ErrorReason); | => new SearchResult(null, null, result.Error, result.ErrorReason); | ||||
| @@ -50,6 +50,8 @@ namespace Discord.Commands | |||||
| => new TypeReaderResult(values, null, null); | => new TypeReaderResult(values, null, null); | ||||
| public static TypeReaderResult FromError(CommandError error, string reason) | public static TypeReaderResult FromError(CommandError error, string reason) | ||||
| => new TypeReaderResult(null, error, reason); | => new TypeReaderResult(null, error, reason); | ||||
| public static TypeReaderResult FromError(Exception ex) | |||||
| => FromError(CommandError.Exception, ex.Message); | |||||
| public static TypeReaderResult FromError(IResult result) | public static TypeReaderResult FromError(IResult result) | ||||
| => new TypeReaderResult(null, result.Error, result.ErrorReason); | => new TypeReaderResult(null, result.Error, result.ErrorReason); | ||||