Skip to content

Commit

Permalink
#331 sqlState is not working anymore for PostgreSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
Tapac committed Jun 29, 2018
1 parent 62bff36 commit 3c5d0d7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/kotlin/org/jetbrains/exposed/sql/Exceptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ class ExposedSQLException(cause: Throwable?, val contexts: List<StatementContext
}
}

private val originalSQLException = cause as? SQLException

override fun getSQLState(): String = originalSQLException?.sqlState.orEmpty()

override fun getErrorCode(): Int = originalSQLException?.errorCode ?: 0

override fun toString() = "${super.toString()}\nSQL: ${causedByQueries()}"
}

Expand Down

0 comments on commit 3c5d0d7

Please sign in to comment.