summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2017-11-24 09:53:58 (GMT)
committerGitHub <noreply@github.com>2017-11-24 09:53:58 (GMT)
commit4864a619dc1cc9092780ccf5a6327e8abf66133d (patch)
tree379ff96504c78c9bd6d05d6c768c3e6cf16ee3a1 /PC
parentcdfe910e746e1d0fc43429b8cc3384a65a19b358 (diff)
downloadcpython-4864a619dc1cc9092780ccf5a6327e8abf66133d.zip
cpython-4864a619dc1cc9092780ccf5a6327e8abf66133d.tar.gz
cpython-4864a619dc1cc9092780ccf5a6327e8abf66133d.tar.bz2
bpo-12382: Make OpenDatabase() raise better exception messages (GH-4528)
Previously, 'msilib.OpenDatabase()' function raised a cryptical exception message when it couldn't open or create an MSI file. For example: Traceback (most recent call last): File "<stdin>", line 1, in <module> _msi.MSIError: unknown error 6e
Diffstat (limited to 'PC')
-rw-r--r--PC/_msi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/PC/_msi.c b/PC/_msi.c
index a6a12e2..8cc1fd5 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -315,6 +315,12 @@ msierror(int status)
case ERROR_INVALID_PARAMETER:
PyErr_SetString(MSIError, "invalid parameter");
return NULL;
+ case ERROR_OPEN_FAILED:
+ PyErr_SetString(MSIError, "open failed");
+ return NULL;
+ case ERROR_CREATE_FAILED:
+ PyErr_SetString(MSIError, "create failed");
+ return NULL;
default:
PyErr_Format(MSIError, "unknown error %x", status);
return NULL;