mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Replace the generic exception class with a more specific one.
This commit is contained in:
committed by
Akshay Joshi
parent
68a5027d15
commit
d6400bbcae
@@ -16,6 +16,7 @@ object.
|
||||
import datetime
|
||||
from flask import session
|
||||
from flask_login import current_user
|
||||
from werkzeug.exceptions import InternalServerError
|
||||
import psycopg2
|
||||
from psycopg2.extensions import adapt
|
||||
from threading import Lock
|
||||
@@ -131,7 +132,7 @@ class Driver(BaseDriver):
|
||||
if _version:
|
||||
return _version
|
||||
|
||||
raise Exception(
|
||||
raise InternalServerError(
|
||||
"Driver Version information for psycopg2 is not available!"
|
||||
)
|
||||
|
||||
@@ -143,7 +144,7 @@ class Driver(BaseDriver):
|
||||
if version:
|
||||
return version
|
||||
|
||||
raise Exception(
|
||||
raise InternalServerError(
|
||||
"libpq version information is not available!"
|
||||
)
|
||||
|
||||
|
@@ -16,6 +16,7 @@ import config
|
||||
from flask import current_app, session
|
||||
from flask_security import current_user
|
||||
from flask_babelex import gettext
|
||||
from werkzeug.exceptions import InternalServerError
|
||||
|
||||
from pgadmin.utils import get_complete_file_path
|
||||
from pgadmin.utils.crypto import decrypt
|
||||
@@ -38,6 +39,7 @@ class ServerManager(object):
|
||||
This class contains the information about the given server.
|
||||
And, acts as connection manager for that particular session.
|
||||
"""
|
||||
_INFORMATION_MSG = gettext("Information is not available.")
|
||||
|
||||
def __init__(self, server):
|
||||
self.connections = dict()
|
||||
@@ -158,17 +160,17 @@ class ServerManager(object):
|
||||
def major_version(self):
|
||||
if self.sversion is not None:
|
||||
return int(self.sversion / 10000)
|
||||
raise Exception(gettext("Information is not available."))
|
||||
raise InternalServerError(self._INFORMATION_MSG)
|
||||
|
||||
def minor_version(self):
|
||||
if self.sversion:
|
||||
return int(int(self.sversion / 100) % 100)
|
||||
raise Exception(gettext("Information is not available."))
|
||||
raise InternalServerError(self._INFORMATION_MSG)
|
||||
|
||||
def patch_version(self):
|
||||
if self.sversion:
|
||||
return int(int(self.sversion / 100) / 100)
|
||||
raise Exception(gettext("Information is not available."))
|
||||
raise InternalServerError(self._INFORMATION_MSG)
|
||||
|
||||
def connection(
|
||||
self, database=None, conn_id=None, auto_reconnect=True, did=None,
|
||||
|
Reference in New Issue
Block a user