Skip to content

Commit

Permalink
fix: First arg of AOORE is param name (#194)
Browse files Browse the repository at this point in the history
* fix: First arg of AOORE is param name

* fix: ArgumentOutOfRangeException first arg is param name
  • Loading branch information
bruno-garcia authored and austinlparker committed Aug 26, 2019
1 parent 589b129 commit 4433dbc
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private byte HexCharToByte(char c)
return (byte)(c - 'A' + 10);
}

throw new ArgumentOutOfRangeException("Invalid character: " + c);
throw new ArgumentOutOfRangeException(nameof(c), $"Invalid character: {c}.");
}

private bool TryExtractTracestate(string[] tracestateCollection, out Tracestate tracestateResult)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public TraceParams Build()

if (!string.IsNullOrEmpty(missing))
{
throw new ArgumentOutOfRangeException("Missing required properties:" + missing);
throw new ArgumentOutOfRangeException(nameof(missing), $"Missing required properties: {missing}.");
}

return new TraceParams(
Expand Down
4 changes: 2 additions & 2 deletions src/OpenTelemetry/Internal/VarInt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static int GetVarInt(byte[] src, int offset, int[] dst)
if (shift >= 32)
{
// Out of range
throw new ArgumentOutOfRangeException("varint too long");
throw new ArgumentOutOfRangeException(nameof(src), "varint too long.");
}

// Get 7 bits from next byte
Expand Down Expand Up @@ -104,7 +104,7 @@ public static int GetVarInt(Stream inputStream)
if (shift >= 32)
{
// Out of range
throw new ArgumentOutOfRangeException("varint too long");
throw new ArgumentOutOfRangeException(nameof(inputStream), "varint too long.");
}

// Get 7 bits from next byte
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Stats/Aggregations/DistributionData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static IDistributionData Create(double mean, long count, double min, doub
{
if (!(min <= max))
{
throw new ArgumentOutOfRangeException("max should be greater or equal to min.");
throw new ArgumentOutOfRangeException(nameof(max), "max should be greater or equal to min.");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Stats/BucketBoundaries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static IBucketBoundaries Create(IEnumerable<double> bucketBoundaries)
var next = bucketBoundariesCopy[i];
if (!(lower < next))
{
throw new ArgumentOutOfRangeException("Bucket boundaries not sorted.");
throw new ArgumentOutOfRangeException(nameof(bucketBoundaries), "Bucket boundaries not sorted.");
}

lower = next;
Expand Down
6 changes: 2 additions & 4 deletions src/OpenTelemetry/Stats/Measures/MeasureDouble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ public static IMeasureDouble Create(string name, string description, string unit
{
if (!(StringUtil.IsPrintableString(name) && name.Length <= NameMaxLength))
{
throw new ArgumentOutOfRangeException(
"Name should be a ASCII string with a length no greater than "
+ NameMaxLength
+ " characters.");
throw new ArgumentOutOfRangeException(nameof(name),
$"Name should be a ASCII string with a length no greater than {NameMaxLength} characters.");
}

return new MeasureDouble(name, description, unit);
Expand Down
6 changes: 2 additions & 4 deletions src/OpenTelemetry/Stats/Measures/MeasureLong.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ public static IMeasureLong Create(string name, string description, string unit)
{
if (!(StringUtil.IsPrintableString(name) && name.Length <= NameMaxLength))
{
throw new ArgumentOutOfRangeException(
"Name should be a ASCII string with a length no greater than "
+ NameMaxLength
+ " characters.");
throw new ArgumentOutOfRangeException(nameof(name),
$"Name should be a ASCII string with a length no greater than {NameMaxLength} characters.");
}

return new MeasureLong(name, description, unit);
Expand Down
6 changes: 2 additions & 4 deletions src/OpenTelemetry/Stats/ViewName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ public static IViewName Create(string name)

if (!(StringUtil.IsPrintableString(name) && name.Length <= NameMaxLength))
{
throw new ArgumentOutOfRangeException(
"Name should be a ASCII string with a length no greater than "
+ NameMaxLength
+ " characters.");
throw new ArgumentOutOfRangeException(nameof(name),
$"Name should be a ASCII string with a length no greater than {NameMaxLength} characters.");
}

return new ViewName(name);
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Trace/Internal/EvictingQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public EvictingQueue(int maxNumEvents)
{
if (maxNumEvents < 0)
{
throw new ArgumentOutOfRangeException($"{nameof(maxNumEvents)} must be >= 0");
throw new ArgumentOutOfRangeException(nameof(maxNumEvents), $"{nameof(maxNumEvents)} must be >= 0.");
}

this.maxNumEvents = maxNumEvents;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Trace/Sampler/ProbabilitySampler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static ProbabilitySampler Create(double probability)
{
if (probability < 0.0 || probability > 1.0)
{
throw new ArgumentOutOfRangeException("probability must be in range [0.0, 1.0]");
throw new ArgumentOutOfRangeException(nameof(probability), "probability must be in range [0.0, 1.0]");
}

long idUpperBound;
Expand Down

0 comments on commit 4433dbc

Please sign in to comment.