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 Jul 30, 2018
1 parent 4242465 commit f045a59
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 @@ -24,6 +24,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 f045a59

Please sign in to comment.