[TASK][!!!] Replaces die() calls with RuntimeException
authorXavier Perseguers <xavier@typo3.org>
Mon, 21 Nov 2011 07:45:24 +0000 (08:45 +0100)
committerXavier Perseguers <xavier@typo3.org>
Mon, 21 Nov 2011 07:48:40 +0000 (08:48 +0100)
Unify the way exceptions are reported by throwing a RuntimeException
instead of calling die(). In some cases, die() discloses the full
script path. This information should be explicitly removed as it is
implicitly part of the Exception's stack trace anyway.

Change-Id: I30f86789c8438acd27c847f3fa9271a3297db5bd
Resolves: #31826
Branches: 4.7, 4.6, 4.5, 4.4, 4.3

typo3/sysext/dbal/class.ux_t3lib_db.php

index 7728c96..c093b75 100644 (file)
@@ -450,7 +450,11 @@ class ux_t3lib_DB extends t3lib_DB {
                                                                $this->handlerInstance[$this->lastHandlerKey]->UpdateBlob($this->quoteFromTables($table), $field, $content, $where);
                                                        } else {
                                                                $this->handlerInstance[$this->lastHandlerKey]->CompleteTrans(FALSE);
-                                                               die('Could not update BLOB >>>> no WHERE clause found!'); // should never ever happen
+                                                                       // Should never ever happen
+                                                               throw new RuntimeException(
+                                                                       'Could not update BLOB >>>> no WHERE clause found!',
+                                                                       1321860519
+                                                               );
                                                        }
                                                }
                                        }
@@ -471,8 +475,9 @@ class ux_t3lib_DB extends t3lib_DB {
                                                                $this->handlerInstance[$this->lastHandlerKey]->UpdateClob($this->quoteFromTables($table), $field, $content, $where);
                                                        } else {
                                                                $this->handlerInstance[$this->lastHandlerKey]->CompleteTrans(FALSE);
+                                                                       // Should never ever happen
                                                                throw new RuntimeException(
-                                                                       'Could not update CLOB >>>> no WHERE clause found!', // should never ever happen
+                                                                       'Could not update CLOB >>>> no WHERE clause found!',
                                                                        1310027337
                                                                );
                                                        }
@@ -1443,7 +1448,7 @@ class ux_t3lib_DB extends t3lib_DB {
                $queryComponents['SELECT'] = $this->SQLparser->parseFieldList($select_fields);
                if ($this->SQLparser->parse_error) {
                        throw new InvalidArgumentException(
-                               $this->SQLparser->parse_error . ' in ' . __FILE__ . ' : ' . __LINE__,
+                               $this->SQLparser->parse_error,
                                1310027408
                        );
                }
@@ -1453,7 +1458,7 @@ class ux_t3lib_DB extends t3lib_DB {
                $queryComponents['WHERE'] = $this->SQLparser->parseWhereClause($where_clause, '', $queryComponents['parameters']);
                if (!is_array($queryComponents['WHERE'])) {
                        throw new InvalidArgumentException(
-                               'Could not parse where clause in ' . __FILE__ . ' : ' . __LINE__,
+                               'Could not parse where clause',
                                1310027427
                        );
                }
@@ -1649,7 +1654,7 @@ class ux_t3lib_DB extends t3lib_DB {
                $select_fields = $this->SQLparser->parseFieldList($select_fields);
                if ($this->SQLparser->parse_error) {
                        throw new InvalidArgumentException(
-                               $this->SQLparser->parse_error . ' in ' . __FILE__ . ' : ' . __LINE__,
+                               $this->SQLparser->parse_error,
                                1310027490
                        );
                }
@@ -1762,7 +1767,7 @@ class ux_t3lib_DB extends t3lib_DB {
                        $where_clause = $this->SQLparser->compileWhereClause($where_clause);
                } else {
                        throw new InvalidArgumentException(
-                               'Could not parse where clause in ' . __FILE__ . ' : ' . __LINE__,
+                               'Could not parse where clause',
                                1310027511
                        );
                }