diff --git a/client/jackson/src/main/kotlin/net/corda/client/jackson/StringToMethodCallParser.kt b/client/jackson/src/main/kotlin/net/corda/client/jackson/StringToMethodCallParser.kt index fb4becec14..3ea6fc8452 100644 --- a/client/jackson/src/main/kotlin/net/corda/client/jackson/StringToMethodCallParser.kt +++ b/client/jackson/src/main/kotlin/net/corda/client/jackson/StringToMethodCallParser.kt @@ -127,7 +127,7 @@ open class StringToMethodCallParser @JvmOverloads constructor( return method.parameters.mapIndexed { index, param -> when { param.isNamePresent -> param.name - // index + 1 because the first Kotlin reflection param is 'this', but that doesn't match Java reflection. + // index + 1 because the first Kotlin reflection param is 'this', but that doesn't match Java reflection. kf != null -> kf.parameters[index + 1].name ?: throw UnparseableCallException.ReflectionDataMissing(method.name, index) else -> throw UnparseableCallException.ReflectionDataMissing(method.name, index) } @@ -153,6 +153,7 @@ open class StringToMethodCallParser @JvmOverloads constructor( class MissingParameter(methodName: String, val paramName: String, command: String) : UnparseableCallException("Parameter $paramName missing from attempt to invoke $methodName in command: $command") class TooManyParameters(methodName: String, command: String) : UnparseableCallException("Too many parameters provided for $methodName: $command") class ReflectionDataMissing(methodName: String, argIndex: Int) : UnparseableCallException("Method $methodName missing parameter name at index $argIndex") + class NoSuchFile(filename: String) : UnparseableCallException("File $filename not found") class FailedParse(e: Exception) : UnparseableCallException(e.message ?: e.toString(), e) } @@ -200,6 +201,8 @@ open class StringToMethodCallParser @JvmOverloads constructor( val entryType = om.typeFactory.constructType(argType) try { om.readValue(entry.traverse(om), entryType) + } catch (e: java.nio.file.NoSuchFileException) { + throw UnparseableCallException.NoSuchFile(e.file ?: entry.toString()) } catch (e: Exception) { throw UnparseableCallException.FailedParse(e) } diff --git a/tools/shell/src/main/kotlin/net/corda/tools/shell/InteractiveShell.kt b/tools/shell/src/main/kotlin/net/corda/tools/shell/InteractiveShell.kt index 86444f179f..94c8091bcf 100644 --- a/tools/shell/src/main/kotlin/net/corda/tools/shell/InteractiveShell.kt +++ b/tools/shell/src/main/kotlin/net/corda/tools/shell/InteractiveShell.kt @@ -499,7 +499,9 @@ object InteractiveShell { } } catch (e: StringToMethodCallParser.UnparseableCallException) { out.println(e.message, Color.red) - out.println("Please try 'man run' to learn what syntax is acceptable") + if (e !is StringToMethodCallParser.UnparseableCallException.NoSuchFile) { + out.println("Please try 'man run' to learn what syntax is acceptable") + } } catch (e: Exception) { out.println("RPC failed: ${e.rootCause}", Color.red) } finally {