forked from pgjdbc/pgjdbc
/
PSQLException.java
34 lines (25 loc) · 948 Bytes
/
PSQLException.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Copyright (c) 2003, PostgreSQL Global Development Group
* See the LICENSE file in the project root for more information.
*/
package org.postgresql.util;
import java.sql.SQLException;
public class PSQLException extends SQLException {
private ServerErrorMessage serverError;
public PSQLException(String msg, PSQLState state, Throwable cause) {
super(msg, state == null ? null : state.getState(), cause);
}
public PSQLException(String msg, PSQLState state) {
super(msg, state == null ? null : state.getState());
}
public PSQLException(ServerErrorMessage serverError) {
this(serverError, true);
}
public PSQLException(ServerErrorMessage serverError, boolean detail) {
super(detail ? serverError.toString() : serverError.getNonSensitiveErrorMessage(), serverError.getSQLState());
this.serverError = serverError;
}
public ServerErrorMessage getServerErrorMessage() {
return serverError;
}
}