Skip to content

Commit

Permalink
add indent for SQL in error logs
Browse files Browse the repository at this point in the history
  • Loading branch information
angryziber committed Aug 1, 2023
1 parent 8cce7a2 commit 81c18fb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions jdbc/src/JdbcExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import java.io.InputStream
import java.sql.*
import java.sql.Statement.NO_GENERATED_KEYS
import java.sql.Statement.RETURN_GENERATED_KEYS
import java.util.*
import javax.sql.DataSource
import kotlin.reflect.KProperty1

Expand Down Expand Up @@ -86,7 +85,7 @@ fun <R> DataSource.withStatement(@Language("SQL") sql: String, keys: Int = NO_GE
prepareStatement(sql, keys).use { it.block() }
} catch (e: SQLException) {
throw if (e.message?.contains("unique constraint") == true) AlreadyExistsException(e)
else SQLException(e.message + "\nSQL: $sql", e.sqlState, e.errorCode, e)
else SQLException(e.message + "\n SQL: $sql", e.sqlState, e.errorCode, e)
}
}

Expand Down

0 comments on commit 81c18fb

Please sign in to comment.