Skip to content

Commit 012465b

Browse files
committed
Rename runChecked to runCatching
Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 9e69e5b commit 012465b

File tree

9 files changed

+20
-19
lines changed

9 files changed

+20
-19
lines changed

src/main/kotlin/com/salesforce/revoman/input/config/StepPick.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ sealed interface StepPick {
3737
companion object PickUtils {
3838
/**
3939
* If there are steps with the same name, you may pass the stepName along with the folderPath,
40-
* where each folder is seperated by FOLDER_DELIMITER {@see com.salesforce.revoman.output.report.Folder.FOLDER_DELIMITER}
41-
* You may not have to pass the entire path,
42-
* you can pass the path from the Least common Ancestor
43-
* to uniquely identify the step of your interest to add this Hook
40+
* where each folder is seperated by FOLDER_DELIMITER {@see
41+
* com.salesforce.revoman.output.report.Folder.FOLDER_DELIMITER} You may not have to pass the
42+
* entire path, you can pass the path from the Least common Ancestor to uniquely identify the
43+
* step of your interest to add this Hook
4444
*/
4545
@JvmStatic
4646
fun beforeStepName(vararg stepNameSubstrings: String) = PreTxnStepPick { currentStep, _, _ ->
@@ -73,11 +73,11 @@ sealed interface StepPick {
7373

7474
companion object PickUtils {
7575
/**
76-
* If there are steps with the same name, you may pass the stepName along with the folderPath,
77-
* where each folder is seperated by FOLDER_DELIMITER {@see com.salesforce.revoman.output.report.Folder.FOLDER_DELIMITER}
78-
* You may not have to pass the entire path,
79-
* you can pass the path from the Least common Ancestor
80-
* to uniquely identify the step of your interest to add this Hook
76+
* If there are steps with the same name, you may pass the stepName along with the folderPath,
77+
* where each folder is seperated by FOLDER_DELIMITER {@see
78+
* com.salesforce.revoman.output.report.Folder.FOLDER_DELIMITER} You may not have to pass the
79+
* entire path, you can pass the path from the Least common Ancestor to uniquely identify the
80+
* step of your interest to add this Hook
8181
*/
8282
@JvmStatic
8383
fun afterStepName(vararg stepNameSubstrings: String) = PostTxnStepPick { stepReport, _ ->

src/main/kotlin/com/salesforce/revoman/internal/exe/ExeUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ internal fun shouldStepBePicked(
7575
return runStep
7676
}
7777

78-
internal fun <T> runChecked(
78+
internal fun <T> runCatching(
7979
currentStep: Step,
8080
exeType: ExeType,
8181
fn: () -> T,

src/main/kotlin/com/salesforce/revoman/internal/exe/HttpRequest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ internal fun fireHttpRequest(
3737
httpRequest: Request,
3838
insecureHttp: Boolean,
3939
): Either<HttpRequestFailure, TxnInfo<Response>> =
40-
runChecked(currentStep, HTTP_REQUEST) {
40+
runCatching(currentStep, HTTP_REQUEST) {
4141
// * NOTE gopala.akshintala 06/08/22: Preparing httpClient for each step,
4242
// * as there can be intermediate auths
4343
// ! TODO 29/01/24 gopala.akshintala: When would bearer token size be > 1?

src/main/kotlin/com/salesforce/revoman/internal/exe/PMJSEval.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal fun executePreReqJS(
2626
): Either<PreReqJSFailure, Unit> {
2727
val preReqJS = item.event?.find { it.listen == "prerequest" }?.script?.exec?.joinToString("\n")
2828
return if (!preReqJS.isNullOrBlank()) {
29-
runChecked(currentStep, PRE_REQ_JS) { executePreReqJSWithPolyglot(preReqJS, item.request, pm) }
29+
runCatching(currentStep, PRE_REQ_JS) { executePreReqJSWithPolyglot(preReqJS, item.request, pm) }
3030
.mapLeft { PreReqJSFailure(it, pm.currentStepReport.requestInfo!!.get()) }
3131
} else {
3232
Right(Unit)
@@ -45,7 +45,7 @@ internal fun executePostResJS(
4545
): Either<PostResJSFailure, Unit> {
4646
val postResJs = item.event?.find { it.listen == "test" }?.script?.exec?.joinToString("\n")
4747
return if (!postResJs.isNullOrBlank()) {
48-
runChecked(currentStep, POST_RES_JS) {
48+
runCatching(currentStep, POST_RES_JS) {
4949
executePostResJSWithPolyglot(postResJs, item.request, pm.currentStepReport, pm)
5050
}
5151
.mapLeft {

src/main/kotlin/com/salesforce/revoman/internal/exe/PostStepHook.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import io.github.oshai.kotlinlogging.KotlinLogging
2121
internal fun postHookExe(kick: Kick, pm: PostmanSDK): PostStepHookFailure? =
2222
pickPostHooks(kick.postHooks(), pm.currentStepReport, pm.rundown)
2323
.map { postHook ->
24-
runChecked(pm.currentStepReport.step, POST_STEP_HOOK) {
24+
runCatching(pm.currentStepReport.step, POST_STEP_HOOK) {
2525
postHook.accept(pm.currentStepReport, pm.rundown)
2626
}
2727
.mapLeft { PostStepHookFailure(it) }

src/main/kotlin/com/salesforce/revoman/internal/exe/PreStepHook.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal fun preHookExe(
2828
): PreStepHookFailure? =
2929
pickPreHooks(kick.preHooks(), currentStep, requestInfo, pm.rundown)
3030
.map { preHook ->
31-
runChecked(currentStep, PRE_STEP_HOOK) {
31+
runCatching(currentStep, PRE_STEP_HOOK) {
3232
preHook.accept(currentStep, requestInfo, pm.rundown)
3333
}
3434
.mapLeft { PreStepHookFailure(it, requestInfo) }

src/main/kotlin/com/salesforce/revoman/internal/exe/UnmarshallRequest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal fun unmarshallRequest(
4141
?.objType ?: Any::class.java
4242
return when {
4343
isJson(httpRequest) ->
44-
runChecked(currentStep, UNMARSHALL_REQUEST) {
44+
runCatching(currentStep, UNMARSHALL_REQUEST) {
4545
pmRequest.body?.let { body -> moshiReVoman.asA(body.raw, requestType.rawType.kotlin) }
4646
}
4747
.mapLeft { UnmarshallRequestFailure(it, TxnInfo(requestType, null, httpRequest)) }

src/main/kotlin/com/salesforce/revoman/internal/exe/UnmarshallResponse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ internal fun unmarshallResponse(
4343
?.also { logger.info { "$currentStep ResponseConfig found : ${pprint(it)}" } }
4444
?.objType ?: Any::class.java
4545
val requestInfo = pm.currentStepReport.requestInfo!!.get()
46-
runChecked(currentStep, UNMARSHALL_RESPONSE) {
46+
runCatching(currentStep, UNMARSHALL_RESPONSE) {
4747
moshiReVoman.asA(httpResponse.bodyString(), responseType.rawType.kotlin)
4848
}
4949
.mapLeft {

src/main/kotlin/com/salesforce/revoman/output/report/Step.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ constructor(
7070

7171
override fun toString(): String =
7272
when {
73-
isRoot -> name
74-
else -> parentPath.joinToString(separator = FOLDER_DELIMITER, postfix = FOLDER_DELIMITER) {
73+
isRoot -> name
74+
else ->
75+
parentPath.joinToString(separator = FOLDER_DELIMITER, postfix = FOLDER_DELIMITER) {
7576
it.name
7677
} + name
7778
}

0 commit comments

Comments
 (0)