changeset 819:55d6c6aeb19a

add file and line info for exceptions without details
author Alain Mazy <am@orthanc.team>
date Tue, 02 Jun 2026 13:09:40 +0200
parents f377801f5980
children e0927885ff73
files Framework/Common/BinaryStringValue.cpp Framework/Common/DatabaseManager.cpp Framework/Common/DatabasesEnumerations.cpp Framework/Common/Dictionary.cpp Framework/Common/GenericFormatter.cpp Framework/Common/IResult.cpp Framework/Common/ImplicitTransaction.cpp Framework/Common/InputFileValue.cpp Framework/Common/Integer32Value.cpp Framework/Common/Integer64Value.cpp Framework/Common/NullValue.cpp Framework/Common/OrthancFrameworkException.h Framework/Common/Query.cpp Framework/Common/ResultBase.cpp Framework/Common/ResultFileValue.cpp Framework/Common/RetryDatabaseFactory.cpp Framework/Common/Utf8StringValue.cpp Framework/MySQL/MySQLDatabase.cpp Framework/MySQL/MySQLParameters.cpp Framework/MySQL/MySQLResult.cpp Framework/MySQL/MySQLStatement.cpp Framework/MySQL/MySQLTransaction.cpp Framework/MySQL/MySQLTransaction.h Framework/Odbc/OdbcDatabase.cpp Framework/Odbc/OdbcEnvironment.cpp Framework/Odbc/OdbcPreparedStatement.cpp Framework/Odbc/OdbcResult.cpp Framework/Odbc/OdbcStatement.cpp Framework/Plugins/DatabaseBackendAdapterV2.cpp Framework/Plugins/DatabaseBackendAdapterV3.cpp Framework/Plugins/DatabaseBackendAdapterV4.cpp Framework/Plugins/DatabaseConstraint.cpp Framework/Plugins/ISqlLookupFormatter.cpp Framework/Plugins/IndexBackend.cpp Framework/Plugins/IndexBackend.h Framework/Plugins/IndexUnitTests.h Framework/Plugins/StorageBackend.cpp Framework/PostgreSQL/PostgreSQLDatabase.cpp Framework/PostgreSQL/PostgreSQLLargeObject.cpp Framework/PostgreSQL/PostgreSQLParameters.cpp Framework/PostgreSQL/PostgreSQLResult.cpp Framework/PostgreSQL/PostgreSQLStatement.cpp Framework/PostgreSQL/PostgreSQLTransaction.cpp Framework/SQLite/SQLiteDatabase.cpp Framework/SQLite/SQLiteResult.cpp Framework/SQLite/SQLiteStatement.cpp Framework/SQLite/SQLiteTransaction.cpp Framework/SQLite/SQLiteTransaction.h MySQL/Plugins/MySQLIndex.cpp Odbc/Plugins/OdbcIndex.cpp PostgreSQL/Plugins/IndexPlugin.cpp PostgreSQL/Plugins/PostgreSQLIndex.cpp PostgreSQL/UnitTests/PostgreSQLTests.cpp Resources/Orthanc/CMake/EmbedResources.py SQLite/Plugins/SQLiteIndex.cpp
diffstat 55 files changed, 169 insertions(+), 135 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Common/BinaryStringValue.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/BinaryStringValue.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -25,7 +25,7 @@
 
 #include "NullValue.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 
--- a/Framework/Common/DatabaseManager.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/DatabaseManager.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -29,7 +29,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/thread.hpp>
 
@@ -104,7 +104,7 @@
       
     if (statement.get() == NULL)
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
     else
     {
@@ -195,13 +195,13 @@
 
       if (database_.get() == NULL)
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
 
       dialect_ = database_->GetDialect();
       if (dialect_ == Dialect_Unknown)
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
     }
 
@@ -213,7 +213,7 @@
   {
     if (database_.get() == NULL)
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
     else
     {
--- a/Framework/Common/DatabasesEnumerations.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/DatabasesEnumerations.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -23,7 +23,7 @@
 
 #include "DatabasesEnumerations.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 namespace OrthancDatabases
 {
--- a/Framework/Common/Dictionary.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/Dictionary.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -31,7 +31,7 @@
 #include "Utf8StringValue.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <cassert>
 
--- a/Framework/Common/GenericFormatter.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/GenericFormatter.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -23,7 +23,7 @@
 
 #include "GenericFormatter.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 
--- a/Framework/Common/IResult.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/IResult.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -26,7 +26,7 @@
 #include "Utf8StringValue.h"
 
 #include <Compatibility.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <cassert>
 #include <list>
--- a/Framework/Common/ImplicitTransaction.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/ImplicitTransaction.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -25,7 +25,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <memory>
 
@@ -83,7 +83,7 @@
         throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
 
       default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);          
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);          
     }
   }
 
@@ -117,7 +117,7 @@
         throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
 
       default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);          
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);          
     }
   }
 
--- a/Framework/Common/InputFileValue.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/InputFileValue.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -26,7 +26,7 @@
 #include "BinaryStringValue.h"
 #include "NullValue.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 
--- a/Framework/Common/Integer32Value.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/Integer32Value.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -27,7 +27,7 @@
 #include "NullValue.h"
 #include "Utf8StringValue.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 
--- a/Framework/Common/Integer64Value.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/Integer64Value.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -27,7 +27,7 @@
 #include "NullValue.h"
 #include "Utf8StringValue.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 
--- a/Framework/Common/NullValue.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/NullValue.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -25,7 +25,7 @@
 
 #include "Utf8StringValue.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 namespace OrthancDatabases
 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Framework/Common/OrthancFrameworkException.h	Tue Jun 02 13:09:40 2026 +0200
@@ -0,0 +1,34 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2023 Osimis S.A., Belgium
+ * Copyright (C) 2024-2026 Orthanc Team SRL, Belgium
+ * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Affero General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#include <OrthancException.h>
+
+#if ORTHANC_ENABLE_LOGGING == 1
+	#define STRINGIFY_LINE_HELPER(line) #line
+	#define STRINGIFY_LINE(line) STRINGIFY_LINE_HELPER(line)
+	#define THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(errorCode) throw Orthanc::OrthancException(errorCode, #errorCode " triggered from " __ORTHANC_FILE__ ":" STRINGIFY_LINE(__LINE__))
+#else
+	#define THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN() throw Orthanc::OrthancException(errorCode)
+#endif
--- a/Framework/Common/Query.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/Query.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -24,7 +24,7 @@
 #include "Query.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/regex.hpp>
 
--- a/Framework/Common/ResultBase.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/ResultBase.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -30,7 +30,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <cassert>
 #include <memory>
@@ -148,7 +148,7 @@
     }
     else if (fields_[index] == NULL)
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
     else
     {
--- a/Framework/Common/ResultFileValue.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/ResultFileValue.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -26,7 +26,7 @@
 #include "BinaryStringValue.h"
 #include "NullValue.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 
--- a/Framework/Common/RetryDatabaseFactory.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/RetryDatabaseFactory.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -24,7 +24,7 @@
 #include "RetryDatabaseFactory.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/thread.hpp>
 
--- a/Framework/Common/Utf8StringValue.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Common/Utf8StringValue.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -27,7 +27,7 @@
 #include "NullValue.h"
 #include "Integer64Value.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 
--- a/Framework/MySQL/MySQLDatabase.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/MySQL/MySQLDatabase.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -32,7 +32,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 #include <Toolbox.h>
 
 #include <errmsg.h>
@@ -156,7 +156,7 @@
     if (mysql_ == NULL)
     {
       LOG(ERROR) << "Cannot initialize the MySQL connector";
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
 
     if (parameters_.GetUnixSocket().empty())
@@ -572,7 +572,7 @@
 
       virtual bool DoesSchemaExist(const std::string& name) ORTHANC_OVERRIDE
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
 
       virtual bool DoesIndexExist(const std::string& name) ORTHANC_OVERRIDE
--- a/Framework/MySQL/MySQLParameters.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/MySQL/MySQLParameters.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -26,7 +26,7 @@
 #include "MySQLDatabase.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 namespace OrthancDatabases
 {
--- a/Framework/MySQL/MySQLResult.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/MySQL/MySQLResult.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -24,7 +24,7 @@
 #include "MySQLResult.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <errmsg.h>
 #include <mysqld_error.h>
--- a/Framework/MySQL/MySQLStatement.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/MySQL/MySQLStatement.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -32,7 +32,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <list>
 #include <memory>
@@ -46,7 +46,7 @@
     {
       if (length_ != buffer_.size())
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
             
       switch (mysqlType_)
@@ -104,7 +104,7 @@
           break;
               
         default:
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);              
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);              
       }
     }
         
@@ -177,7 +177,7 @@
 
             default:
               LOG(ERROR) << "Unsupported MySQL charset: " << field.charsetnr;
-              throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);                
+              THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);                
           }
 
           if (field.max_length > 0)
@@ -189,7 +189,7 @@
           
         default:
           LOG(ERROR) << "MYSQL_TYPE not implemented: " << field.type;
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
     }
         
@@ -268,7 +268,7 @@
           }
           else
           {
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
           }
         }
 
@@ -283,7 +283,7 @@
       }
       else
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }          
     }
   };
@@ -375,7 +375,7 @@
     if (mysql_stmt_param_count(statement_) != formatter_.GetParametersCount())
     {
       Close();
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
 
     try
@@ -393,7 +393,7 @@
 
       if (result_.size() != result.GetFieldsCount())
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
     }
     catch (Orthanc::OrthancException&)
@@ -524,7 +524,7 @@
           }
 
           default:
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+            THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
       }
     }
--- a/Framework/MySQL/MySQLTransaction.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/MySQL/MySQLTransaction.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -27,7 +27,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <memory>
 
--- a/Framework/MySQL/MySQLTransaction.h	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/MySQL/MySQLTransaction.h	Tue Jun 02 13:09:40 2026 +0200
@@ -66,7 +66,7 @@
 
     virtual bool DoesSchemaExist(const std::string& name) ORTHANC_OVERRIDE
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
 
     virtual bool DoesIndexExist(const std::string& name) ORTHANC_OVERRIDE
--- a/Framework/Odbc/OdbcDatabase.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Odbc/OdbcDatabase.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -31,7 +31,7 @@
 #include "OdbcResult.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 #include <Toolbox.h>
 
 #include <boost/algorithm/string/predicate.hpp>
@@ -86,7 +86,7 @@
 
     virtual bool DoesSchemaExist(const std::string& name) ORTHANC_OVERRIDE
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
 
     virtual bool DoesIndexExist(const std::string& name) ORTHANC_OVERRIDE
@@ -200,7 +200,7 @@
 
     virtual bool DoesSchemaExist(const std::string& name) ORTHANC_OVERRIDE
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
 
     virtual bool DoesIndexExist(const std::string& name) ORTHANC_OVERRIDE
@@ -619,7 +619,7 @@
               break;
 
             default:
-              throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+              THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
           }
         }
 
--- a/Framework/Odbc/OdbcEnvironment.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Odbc/OdbcEnvironment.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -24,7 +24,7 @@
 #include "OdbcEnvironment.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 #include <sqlext.h>
--- a/Framework/Odbc/OdbcPreparedStatement.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Odbc/OdbcPreparedStatement.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -29,7 +29,7 @@
 #include "OdbcResult.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <cassert>
 #include <sqlext.h>
@@ -74,7 +74,7 @@
           break;
             
         default:
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
     }
 
@@ -151,7 +151,7 @@
               break;
 
             default:
-              throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+              THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
           }
 
           SQLLEN null = SQL_NULL_DATA;
@@ -229,7 +229,7 @@
             }
 
             default:
-              throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+              THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
           }
         }
       }
--- a/Framework/Odbc/OdbcResult.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Odbc/OdbcResult.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -30,7 +30,7 @@
 
 #include <ChunkedBuffer.h>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 #include <Toolbox.h>
 
 #include <boost/lexical_cast.hpp>
@@ -386,7 +386,7 @@
     }
     else if (values_[field] == NULL)
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
     else
     {
--- a/Framework/Odbc/OdbcStatement.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Odbc/OdbcStatement.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -27,7 +27,7 @@
 #include "OdbcEnvironment.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <sqlext.h>
 
--- a/Framework/Plugins/DatabaseBackendAdapterV2.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Plugins/DatabaseBackendAdapterV2.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -27,7 +27,7 @@
 
 #include "IndexBackend.h"
 
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 
 #include <boost/thread/mutex.hpp>
 #include <list>
--- a/Framework/Plugins/DatabaseBackendAdapterV3.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Plugins/DatabaseBackendAdapterV3.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -29,7 +29,7 @@
 #include "IndexConnectionsPool.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 
 #include <stdexcept>
 #include <list>
@@ -178,7 +178,7 @@
           break;
         
         default:
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
       
       answerType_ = _OrthancPluginDatabaseAnswerType_None;
--- a/Framework/Plugins/DatabaseBackendAdapterV4.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Plugins/DatabaseBackendAdapterV4.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -34,7 +34,7 @@
 #include <OrthancDatabasePlugin.pb.h>  // Include protobuf messages
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 
 #include <stdexcept>
 #include <list>
@@ -506,7 +506,7 @@
 
       case Orthanc::DatabasePluginMessages::OPERATION_FLUSH_TO_DISK:
         // Raise an exception since "set_supports_flush_to_disk(false)"
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
 
       case Orthanc::DatabasePluginMessages::OPERATION_START_TRANSACTION:
       {
@@ -1273,7 +1273,7 @@
             case OrthancPluginResourceType_Instance:
               if (parent.empty())
               {
-                throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+                THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
               }
               else
               {
@@ -1284,7 +1284,7 @@
             case OrthancPluginResourceType_Patient:
               if (!parent.empty())
               {
-                throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+                THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
               }
               break;
 
--- a/Framework/Plugins/DatabaseConstraint.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Plugins/DatabaseConstraint.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -30,7 +30,7 @@
 
 #include "DatabaseConstraint.h"
 
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 #include <cassert>
@@ -278,7 +278,7 @@
         }
 
         default:
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
 
       s += "\n";
--- a/Framework/Plugins/ISqlLookupFormatter.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Plugins/ISqlLookupFormatter.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -32,7 +32,7 @@
 
 #include "DatabaseConstraint.h"
 
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 #include <Toolbox.h>
 
 #include <boost/algorithm/string/join.hpp>
@@ -60,7 +60,7 @@
         return "instances";
 
       default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
   }
 
@@ -83,7 +83,7 @@
         return std::string(prefix) + "instances";
 
       default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
   }      
 #endif
@@ -124,7 +124,7 @@
             break;
 
           default:
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
 
         std::string parameter = formatter.GenerateParameter(values[0]);
@@ -496,7 +496,7 @@
             break;
 
           default:
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
 
         std::string parameter = formatter.GenerateParameter(constraint.GetSingleValue());
@@ -764,7 +764,7 @@
     }
     else
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
   }
 
@@ -781,7 +781,7 @@
       case Orthanc::ResourceType_Instance:
         return request.orthanc_id_instance();
       default:
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
   }
   
@@ -828,7 +828,7 @@
             FormatJoinForOrdering(orderingJoin, ordering.metadata(), i, queryLevel);
             break;
           default:
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
 
         orderingJoins += orderingJoin;
--- a/Framework/Plugins/IndexBackend.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -31,7 +31,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 #include <Toolbox.h>
 
 #if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 12, 11)
@@ -109,7 +109,7 @@
     {
       if (statement.GetResultFieldsCount() != 1)
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
       
       statement.SetResultFieldType(0, ValueType_Integer64);
@@ -135,7 +135,7 @@
     {
       if (statement.GetResultFieldsCount() != 1)
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
       
       while (!statement.IsDone())
@@ -2001,7 +2001,7 @@
                                      OrthancPluginStorageArea* storageArea)
   {
     LOG(ERROR) << "Upgrading database is not implemented by this plugin";
-    throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+    THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
   }
 
     
@@ -2519,7 +2519,7 @@
             break;
 
           default:
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
       }
     }
@@ -2557,7 +2557,7 @@
             break;
 
           default:
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
       }
     }
@@ -2865,7 +2865,7 @@
   {
     if (statement.GetResultFieldsCount() != 3)
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
 
     statement.SetResultFieldType(0, ValueType_Integer64);
@@ -2888,7 +2888,7 @@
         break;
 
       default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
       
     assert((statement.Next(), statement.IsDone()));
@@ -2920,7 +2920,7 @@
     {
       if (statement.GetResultFieldsCount() != 2)
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
       
       statement.SetResultFieldType(0, ValueType_Integer64);
@@ -3499,7 +3499,7 @@
                 "   INNER JOIN Lookup ON childLevel.parentId = Lookup.internalId";
         }; break;
         default:
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
       sql += ", _OneInstance AS (" + oneInstanceSqlCTE + ") ";
       sql += ", OneInstance AS (SELECT parentInternalId, instancePublicId, instanceInternalId FROM _OneInstance WHERE rowNum = 1) ";  // this is a generic way to implement DISTINCT ON
@@ -4595,7 +4595,7 @@
       {
         if (statement->GetResultFieldsCount() != 2)
         {
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
         
         statement->SetResultFieldType(0, ValueType_Utf8String);
@@ -4934,7 +4934,7 @@
       {
         if (statement.GetResultFieldsCount() != 7)
         {
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
         
         statement.SetResultFieldType(0, ValueType_Utf8String);
--- a/Framework/Plugins/IndexBackend.h	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Plugins/IndexBackend.h	Tue Jun 02 13:09:40 2026 +0200
@@ -25,7 +25,7 @@
 
 #include "IDatabaseBackend.h"
 
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 
 #include <boost/thread/shared_mutex.hpp>
 
@@ -390,7 +390,7 @@
                                 const char* hashSeries,
                                 const char* hashInstance) ORTHANC_OVERRIDE
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
 #endif
 
--- a/Framework/Plugins/IndexUnitTests.h	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Plugins/IndexUnitTests.h	Tue Jun 02 13:09:40 2026 +0200
@@ -249,7 +249,7 @@
       if (!db.GetKeyValue(value, manager, storeId, item.key()) ||
           value != item.value())
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
     }
   }
@@ -282,7 +282,7 @@
 
     if (keys.size() != keys2.size())
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
     else
     {
@@ -290,7 +290,7 @@
       {
         if (keys2.find(*it) == keys2.end())
         {
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
       }
     }
@@ -933,7 +933,7 @@
           break;
 
         default:
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
     
       {
--- a/Framework/Plugins/StorageBackend.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/Plugins/StorageBackend.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -32,7 +32,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "../../Framework/Common/OrthancFrameworkException.h"
 
 #include <boost/thread.hpp>
 #include <cassert>
@@ -349,7 +349,7 @@
       {
         if (success_)
         {
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
         else
         {
@@ -425,13 +425,13 @@
       {
         if (success_)
         {
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
         else
         {
           if (content.size() != target_->size)
           {
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
           }
           
           if (!content.empty())
@@ -543,7 +543,7 @@
       {
         if (success_)
         {
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
         else if (data_ == NULL)
         {
@@ -730,7 +730,7 @@
     {
       if (success_)
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
       else
       {
@@ -751,7 +751,7 @@
 
     if (!visitor.IsSuccess())
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
   }
     
@@ -768,7 +768,7 @@
 
     if (!visitor.IsSuccess())
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
   }
 
@@ -778,7 +778,7 @@
     std::unique_ptr<IAccessor> accessor(CreateAccessor());
     if (accessor.get() == NULL)
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
     
 #if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 2)
--- a/Framework/PostgreSQL/PostgreSQLDatabase.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/PostgreSQL/PostgreSQLDatabase.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -31,7 +31,7 @@
 #include "PostgreSQLTransaction.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 #include <Toolbox.h>
 
 #include <boost/lexical_cast.hpp>
--- a/Framework/PostgreSQL/PostgreSQLLargeObject.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/PostgreSQL/PostgreSQLLargeObject.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -27,7 +27,7 @@
 #include "PostgreSQLLargeObject.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 #include <libpq/libpq-fs.h>
@@ -164,7 +164,7 @@
     {
       if (target.size() != size_)
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
       
       PGconn* pg = reinterpret_cast<PGconn*>(database_.pg_);
--- a/Framework/PostgreSQL/PostgreSQLParameters.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/PostgreSQL/PostgreSQLParameters.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -24,7 +24,7 @@
 #include "PostgreSQLParameters.h"
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 #include <Toolbox.h>
 
 #include <boost/lexical_cast.hpp>
--- a/Framework/PostgreSQL/PostgreSQLResult.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/PostgreSQL/PostgreSQLResult.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -31,7 +31,7 @@
 #include "../Common/Utf8StringValue.h"
 
 #include <Compatibility.h>  // For std::unique_ptr<>
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 #include <Logging.h>
 #include <Endianness.h>
 
--- a/Framework/PostgreSQL/PostgreSQLStatement.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/PostgreSQL/PostgreSQLStatement.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -35,7 +35,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 #include <Toolbox.h>
 #include <Endianness.h>
 
@@ -580,7 +580,7 @@
           }
 
           default:
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+            THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
         }
       }
     }
--- a/Framework/PostgreSQL/PostgreSQLTransaction.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/PostgreSQL/PostgreSQLTransaction.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -27,7 +27,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "../Common/OrthancFrameworkException.h"
 
 namespace OrthancDatabases
 {
--- a/Framework/SQLite/SQLiteDatabase.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/SQLite/SQLiteDatabase.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -27,7 +27,7 @@
 #include "SQLiteTransaction.h"
 #include "../Common/ImplicitTransaction.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 #include <Toolbox.h>
 
 namespace OrthancDatabases
@@ -80,7 +80,7 @@
 
       virtual bool DoesSchemaExist(const std::string& name) ORTHANC_OVERRIDE
       {
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
 
       virtual bool DoesIndexExist(const std::string& name) ORTHANC_OVERRIDE
--- a/Framework/SQLite/SQLiteResult.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/SQLite/SQLiteResult.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -28,7 +28,7 @@
 #include "../Common/NullValue.h"
 #include "../Common/Utf8StringValue.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 namespace OrthancDatabases
 {
@@ -37,7 +37,7 @@
   {
     if (statement_.GetObject().ColumnCount() < 0)
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
     else
     {
@@ -67,7 +67,7 @@
         
       case Orthanc::SQLite::COLUMN_TYPE_FLOAT:
       default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
   }
   
--- a/Framework/SQLite/SQLiteStatement.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/SQLite/SQLiteStatement.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -30,7 +30,7 @@
 #include "../Common/Utf8StringValue.h"
 #include "SQLiteResult.h"
 
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 namespace OrthancDatabases
 {
@@ -49,7 +49,7 @@
   {
     if (statement_.get() == NULL)
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
     else
     {
@@ -99,7 +99,7 @@
           break;
 
         default:
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
     }    
   }
--- a/Framework/SQLite/SQLiteTransaction.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/SQLite/SQLiteTransaction.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -27,7 +27,7 @@
 #include "SQLiteStatement.h"
 
 #include <Compatibility.h>  // For std::unique_ptr<>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 namespace OrthancDatabases
 {
@@ -39,7 +39,7 @@
 
     if (!transaction_.IsOpen())
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
   }
 
--- a/Framework/SQLite/SQLiteTransaction.h	Mon Jun 01 22:55:53 2026 +0200
+++ b/Framework/SQLite/SQLiteTransaction.h	Tue Jun 02 13:09:40 2026 +0200
@@ -71,7 +71,7 @@
 
     virtual bool DoesSchemaExist(const std::string& name) ORTHANC_OVERRIDE
     {
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+      THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
 
     virtual bool DoesIndexExist(const std::string& name) ORTHANC_OVERRIDE
--- a/MySQL/Plugins/MySQLIndex.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/MySQL/Plugins/MySQLIndex.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -32,7 +32,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 #include <ctype.h>
 
@@ -150,7 +150,7 @@
         if (!t.GetDatabaseTransaction().DoesTableExist("PatientRecyclingOrder"))
         {
           LOG(ERROR) << "Corrupted MySQL database";
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);        
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);        
         }
 
         // This is the last item to be created
--- a/Odbc/Plugins/OdbcIndex.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/Odbc/Plugins/OdbcIndex.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -30,7 +30,7 @@
 #include <EmbeddedResources.h>  // Autogenerated file
 
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 #include <Toolbox.h>
 
 #include <boost/algorithm/string/replace.hpp>
@@ -202,7 +202,7 @@
         break;
 
       default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
   }
 
@@ -370,7 +370,7 @@
       }
 
       default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
   }
 
@@ -481,7 +481,7 @@
           break;
 
         default:
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
     }
 
@@ -660,7 +660,7 @@
       }
 
       default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
     }
     
     std::string value = boost::lexical_cast<std::string>(seq);
@@ -731,14 +731,14 @@
                                 DatabaseManager& manager,
                                 const Orthanc::DatabasePluginMessages::Find_Request& request)
   {
-    throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+    THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
   }
 
   void OdbcIndex::ExecuteCount(Orthanc::DatabasePluginMessages::TransactionResponse& response,
                                  DatabaseManager& manager,
                                  const Orthanc::DatabasePluginMessages::Find_Request& request)
   {
-    throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+    THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
   }
 #endif
 }
--- a/PostgreSQL/Plugins/IndexPlugin.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/PostgreSQL/Plugins/IndexPlugin.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -42,7 +42,7 @@
 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0)
     GOOGLE_PROTOBUF_VERIFY_VERSION;
 #endif
-
+    
     if (!OrthancDatabases::InitializePlugin(context, ORTHANC_PLUGIN_NAME, "PostgreSQL", true))
     {
       return -1;
--- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -34,7 +34,7 @@
 #include <Toolbox.h>
 #include <SystemToolbox.h>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "../../Framework/Common/OrthancFrameworkException.h"
 
 #include <boost/algorithm/string/join.hpp>
 
@@ -129,7 +129,7 @@
         if (!t.GetDatabaseTransaction().DoesSchemaExist(parameters_.GetSchema()))
         {
           LOG(ERROR) << "The schema '" << parameters_.GetSchema() << "' does not exist.  If you are not using the 'public' schema, you must create the schema manually before starting Orthanc.";
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);        
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);        
         }
 
         if (!t.GetDatabaseTransaction().DoesTableExist("Resources"))
@@ -142,7 +142,7 @@
           if (!t.GetDatabaseTransaction().DoesTableExist("Resources"))
           {
             LOG(ERROR) << "Corrupted PostgreSQL database or failed to create the database schema";
-            throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);        
+            THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);        
           }
         }
         else
--- a/PostgreSQL/UnitTests/PostgreSQLTests.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/PostgreSQL/UnitTests/PostgreSQLTests.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -44,7 +44,7 @@
 #include "../Plugins/PostgreSQLStorageArea.h"
 
 #include <Compatibility.h>  // For std::unique_ptr<>
-#include <OrthancException.h>
+#include "../../Framework/Common/OrthancFrameworkException.h"
 
 #include <boost/lexical_cast.hpp>
 
--- a/Resources/Orthanc/CMake/EmbedResources.py	Mon Jun 01 22:55:53 2026 +0200
+++ b/Resources/Orthanc/CMake/EmbedResources.py	Tue Jun 02 13:09:40 2026 +0200
@@ -277,7 +277,7 @@
 elif FRAMEWORK_PATH != None:
     cpp.write('#include "%s/OrthancException.h"' % FRAMEWORK_PATH)
 else:
-    cpp.write('#include <OrthancException.h>')
+    cpp.write('#include "OrthancFrameworkException.h"')
 
 cpp.write("""
 #include <stdint.h>
--- a/SQLite/Plugins/SQLiteIndex.cpp	Mon Jun 01 22:55:53 2026 +0200
+++ b/SQLite/Plugins/SQLiteIndex.cpp	Tue Jun 02 13:09:40 2026 +0200
@@ -32,7 +32,7 @@
 
 #include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
-#include <OrthancException.h>
+#include "OrthancFrameworkException.h"
 
 namespace OrthancDatabases
 {
@@ -131,7 +131,7 @@
       if (!t.GetDatabaseTransaction().DoesTableExist("Resources"))
       {
         LOG(ERROR) << "Corrupted SQLite database";
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);        
+        THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);        
       }
 
       int version = 0;
@@ -270,7 +270,7 @@
           
         default:
           //LOG(ERROR) << value.Format();
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+          THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
       }
     }
   }
@@ -289,14 +289,14 @@
                                 DatabaseManager& manager,
                                 const Orthanc::DatabasePluginMessages::Find_Request& request)
   {
-    throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+    THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
   }
 
   void SQLiteIndex::ExecuteCount(Orthanc::DatabasePluginMessages::TransactionResponse& response,
                                  DatabaseManager& manager,
                                  const Orthanc::DatabasePluginMessages::Find_Request& request)
   {
-    throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+    THROW_WITH_FILE_AND_LINE_INFO_FROM_PLUGIN(Orthanc::ErrorCode_NotImplemented);
   }
 #endif