Skip to content

Commit

Permalink
Explain get handler logic and fix coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
miland-db committed Aug 12, 2024
1 parent 29f1afb commit 5389e0c
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,13 @@ class CompoundBodyExec(
*/
private def getHandler(condition: String): Option[ErrorHandlerExec] = {
conditionHandlerMap.get(condition)
.orElse(conditionHandlerMap.get("NOT FOUND") match {
case Some(handler) if condition.startsWith("02") => Some(handler)
case _ => None
})
.orElse(conditionHandlerMap.get("SQLEXCEPTION"))
.orElse{
conditionHandlerMap.get("NOT FOUND") match {
// If NOT FOUND handler is defined, use it only for errors with class '02'.
case Some(handler) if condition.startsWith("02") => Some(handler)
case _ => None
}}
.orElse{conditionHandlerMap.get("SQLEXCEPTION")}
}

/**
Expand Down

0 comments on commit 5389e0c

Please sign in to comment.