summaryrefslogtreecommitdiffstats
path: root/keystone/exception.py
diff options
context:
space:
mode:
authorTony NIU <niuwl586@gmail.com>2013-01-09 20:09:40 +0800
committerTony NIU <niuwl586@gmail.com>2013-01-15 08:43:28 +0800
commit9c2c4ece645119fd450783217c359b38584553c8 (patch)
treeb6f13baf986da692864ae621629730cc697e6063 /keystone/exception.py
parent9460ff5c35809f4911cb5a1ee5f68d6351e797f4 (diff)
downloadkeystone-9c2c4ece645119fd450783217c359b38584553c8.tar.gz
keystone-9c2c4ece645119fd450783217c359b38584553c8.tar.xz
keystone-9c2c4ece645119fd450783217c359b38584553c8.zip
add database string field length check
Added database string field length check, so when insert to a table, if the length of string field exceed the limit of column when, it will return a 400 error instead of truncating the string. Change-Id: I7216fe736ea6e5a23b5647b107fcb2699f1fa99d Fixes: bug #1090247
Diffstat (limited to 'keystone/exception.py')
-rw-r--r--keystone/exception.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/keystone/exception.py b/keystone/exception.py
index 96caf322..9923f578 100644
--- a/keystone/exception.py
+++ b/keystone/exception.py
@@ -73,6 +73,11 @@ class ValidationError(Error):
title = 'Bad Request'
+class StringLengthExceeded(ValidationError):
+ """The length of string "%(string)s" exceeded the limit of column
+ %(type)s(CHAR(%(length)d))."""
+
+
class SecurityError(Error):
"""Avoids exposing details of security failures, unless in debug mode."""