Skip to content

Commit 336edca

Browse files
committed
Merge branch 'Mahoney-forks-better-either-value-errors' into 3.1.x
2 parents b0a691a + 51dcc56 commit 336edca

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

scalatest-test/src/test/scala/org/scalatest/EitherValuesSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class EitherValuesSpec extends FunSpec {
3838
}
3939
caught.failedCodeLineNumber.value should equal (thisLineNumber - 2)
4040
caught.failedCodeFileName.value should be ("EitherValuesSpec.scala")
41-
caught.message.value should be (Resources.eitherLeftValueNotDefined)
41+
caught.message.value should be (Resources.eitherLeftValueNotDefined(e))
4242
}
4343

4444
it("should return the right value inside an either if right.value is defined") {
@@ -55,7 +55,7 @@ class EitherValuesSpec extends FunSpec {
5555
}
5656
caught.failedCodeLineNumber.value should equal (thisLineNumber - 2)
5757
caught.failedCodeFileName.value should be ("EitherValuesSpec.scala")
58-
caught.message.value should be (Resources.eitherRightValueNotDefined)
58+
caught.message.value should be (Resources.eitherRightValueNotDefined(e))
5959
}
6060

6161
it("should allow an immediate application of parens to invoke apply on the type contained in the Left") {

scalatest-test/src/test/scala/org/scalatest/TryValuesSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TryValuesSpec extends FunSpec {
4242
}
4343
caught.failedCodeLineNumber.value should equal (thisLineNumber - 2)
4444
caught.failedCodeFileName.value should be ("TryValuesSpec.scala")
45-
caught.message.value should be (Resources.tryNotAFailure)
45+
caught.message.value should be (Resources.tryNotAFailure(t))
4646
}
4747

4848
it("should return the value inside a Try if it is a Success") {
@@ -59,7 +59,7 @@ class TryValuesSpec extends FunSpec {
5959
}
6060
caught.failedCodeLineNumber.value should equal (thisLineNumber - 2)
6161
caught.failedCodeFileName.value should be ("TryValuesSpec.scala")
62-
caught.message.value should be (Resources.tryNotASuccess)
62+
caught.message.value should be (Resources.tryNotASuccess(t))
6363
}
6464
}
6565
}

scalatest/src/main/resources/org/scalatest/ScalaTestBundle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,11 +568,11 @@ concurrentFeatureSpecMod=Two threads attempted to modify FeatureSpec's internal
568568
concurrentFixtureFeatureSpecMod=Two threads attempted to modify FixtureFeatureSpec's internal data, which should only be modified by the thread that constructs the object. This likely means that a subclass has allowed the this reference to escape during construction, and some other thread attempted to invoke the "feature" or "scenario" methods on the object before the first thread completed its construction.
569569
concurrentDocSpecMod=Two threads attempted to modify Doc's internal data, which should only be modified by the thread that constructs the object. This likely means that a subclass has allowed the this reference to escape during construction, and some other thread attempted to invoke the "body" method on the object before the first thread completed its construction.
570570

571-
tryNotAFailure=The Try on which failure was invoked was not a Failure.
572-
tryNotASuccess=The Try on which success was invoked was not a Success.
571+
tryNotAFailure=The Try on which failure was invoked was not a Failure; it was {0}.
572+
tryNotASuccess=The Try on which success was invoked was not a Success; it was {0}.
573573
optionValueNotDefined=The Option on which value was invoked was not defined.
574-
eitherLeftValueNotDefined=The Either on which left.value was invoked was not defined as a Left.
575-
eitherRightValueNotDefined=The Either on which right.value was invoked was not defined as a Right.
574+
eitherLeftValueNotDefined=The Either on which left.value was invoked was not defined as a Left; it was {0}.
575+
eitherRightValueNotDefined=The Either on which right.value was invoked was not defined as a Right; it was {0}.
576576
partialFunctionValueNotDefined=The PartialFunction on which valueAt( {0} ) was invoked was not defined.
577577

578578
insidePartialFunctionNotDefined=The partial function passed as the second parameter to inside was not defined at the value passed as the first parameter to inside, which was: {0}

scalatest/src/main/scala/org/scalatest/EitherValues.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ trait EitherValues {
121121
}
122122
catch {
123123
case cause: NoSuchElementException =>
124-
throw new TestFailedException((_: StackDepthException) => Some(Resources.eitherLeftValueNotDefined), Some(cause), pos)
124+
throw new TestFailedException((_: StackDepthException) => Some(Resources.eitherLeftValueNotDefined(leftProj.e)), Some(cause), pos)
125125
}
126126
}
127127
}
@@ -149,7 +149,7 @@ trait EitherValues {
149149
}
150150
catch {
151151
case cause: NoSuchElementException =>
152-
throw new TestFailedException((_: StackDepthException) => Some(Resources.eitherRightValueNotDefined), Some(cause), pos)
152+
throw new TestFailedException((_: StackDepthException) => Some(Resources.eitherRightValueNotDefined(rightProj.e)), Some(cause), pos)
153153
}
154154
}
155155
}

scalatest/src/main/scala/org/scalatest/TryValues.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ trait TryValues {
119119
theTry match {
120120
case failure: Failure[T] => failure
121121
case _ =>
122-
throw new TestFailedException((_: StackDepthException) => Some(Resources.tryNotAFailure), None, pos)
122+
throw new TestFailedException((_: StackDepthException) => Some(Resources.tryNotAFailure(theTry)), None, pos)
123123
}
124124
}
125125

@@ -131,7 +131,7 @@ trait TryValues {
131131
theTry match {
132132
case success: Success[T] => success
133133
case _ =>
134-
throw new TestFailedException((_: StackDepthException) => Some(Resources.tryNotASuccess), None, pos)
134+
throw new TestFailedException((_: StackDepthException) => Some(Resources.tryNotASuccess(theTry)), None, pos)
135135
}
136136
}
137137
}

0 commit comments

Comments
 (0)