Skip to content

Commit cccdff1

Browse files
committed
Merge from dev
2 parents f5f45a8 + b3d9dcb commit cccdff1

File tree

6 files changed

+34
-4
lines changed

6 files changed

+34
-4
lines changed

src/Vertical.CommandLine/Vertical.CommandLine.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
99
<Description>Simple command line argument mapping</Description>
1010
<Authors>Vertical Software contributors</Authors>
11-
<VersionPrefix>1.0.1</VersionPrefix>
11+
<VersionPrefix>1.0.2</VersionPrefix>
1212
<PackageId>vertical-commandline</PackageId>
1313
<PackageTags>commandline;utilities</PackageTags>
1414
<PackageProjectUrl>https://github.com/verticalsoftware/vertical-commandline</PackageProjectUrl>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Diagnostics.CodeAnalysis;
3+
4+
namespace Vertical.CommandLine
5+
{
6+
/// <summary>
7+
/// Represents the base type for exceptions in this namespace.
8+
/// </summary>
9+
[ExcludeFromCodeCoverage]
10+
public abstract class CommandLineException : Exception
11+
{
12+
/// <summary>
13+
/// Creates a new instance of this type.
14+
/// </summary>
15+
/// <param name="message">Message</param>
16+
/// <param name="innerException">Inner exception or null reference.</param>
17+
protected CommandLineException(string message, Exception innerException = null)
18+
: base(message, innerException)
19+
{
20+
}
21+
}
22+
}

src/Vertical.CommandLine/Vertical/CommandLine/Configuration/ConfigurationException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Vertical.CommandLine.Configuration
1919
/// - A converter wasn't specified, and the API didn't find an out-of-box option
2020
/// - An exception was thrown in mapping, conversion or validation delegate code
2121
/// </remarks>
22-
public sealed class ConfigurationException : Exception
22+
public sealed class ConfigurationException : CommandLineException
2323
{
2424
/// <inheritdoc />
2525
internal ConfigurationException(string message, Exception innerException = null)

src/Vertical.CommandLine/Vertical/CommandLine/Mapping/DelegateMapper.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public virtual void MapValue(TOptions options, TValue value)
3737
{
3838
throw ConfigurationExceptions.NullReferenceInMapping<TOptions>(ex);
3939
}
40+
catch (UsageException)
41+
{
42+
throw;
43+
}
4044
catch (Exception ex)
4145
{
4246
throw ConfigurationExceptions.ErrorInDelegateMapping(ex);

src/Vertical.CommandLine/Vertical/CommandLine/Mapping/Mapper.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ internal static void MapValue<TOptions, TValue>(IMapper<TOptions, TValue> mapper
3232
{
3333
mapper.MapValue(options, value);
3434
}
35-
catch (Exception ex) when (!(ex is UsageException))
35+
catch (CommandLineException)
36+
{
37+
throw;
38+
}
39+
catch (Exception ex)
3640
{
3741
throw ConfigurationExceptions.MappingFailed(context, ex);
3842
}

src/Vertical.CommandLine/Vertical/CommandLine/UsageException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Vertical.CommandLine
1111
/// <summary>
1212
/// Represents an error caused by user input.
1313
/// </summary>
14-
public class UsageException : Exception
14+
public class UsageException : CommandLineException
1515
{
1616
/// <summary>
1717
/// Creates a new instance.

0 commit comments

Comments
 (0)