diff --git a/hapic/context.py b/hapic/context.py
index 97aa0c4..7b5d9b9 100644
--- a/hapic/context.py
+++ b/hapic/context.py
@@ -135,6 +135,15 @@ class ContextInterface(object):
         """
         raise NotImplementedError()
 
+    def is_debug(self) -> bool:
+        """
+        Method called to know if Hapic has been called in debug mode.
+        Debug mode provide some informations like debug trace and error
+        message in body when internal error happen.
+        :return: True if in debug mode
+        """
+        raise NotImplementedError()
+
 
 class HandledException(object):
     """
diff --git a/hapic/decorator.py b/hapic/decorator.py
index 10c6036..8d7f284 100644
--- a/hapic/decorator.py
+++ b/hapic/decorator.py
@@ -420,7 +420,10 @@ class ExceptionHandlerControllerWrapper(ControllerWrapper):
                 func_kwargs,
             )
         except self.handled_exception_class as exc:
-            response_content = self.error_builder.build_from_exception(exc)
+            response_content = self.error_builder.build_from_exception(
+                exc,
+                include_traceback=self.context.is_debug(),
+            )
 
             # Check error format
             dumped = self.error_builder.dump(response_content).data
diff --git a/hapic/error.py b/hapic/error.py
index 9157657..073b849 100644
--- a/hapic/error.py
+++ b/hapic/error.py
@@ -1,4 +1,6 @@
 # -*- coding: utf-8 -*-
+import traceback
+
 import marshmallow
 
 from hapic.processor import ProcessValidationError
@@ -9,7 +11,11 @@ class ErrorBuilderInterface(marshmallow.Schema):
     ErrorBuilder is a class who represent a Schema (marshmallow.Schema) and
     can generate a response content from exception (build_from_exception)
     """
-    def build_from_exception(self, exception: Exception) -> dict:
+    def build_from_exception(
+        self,
+        exception: Exception,
+        include_traceback: bool = False,
+    ) -> dict:
         """
         Build the error response content from given exception
         :param exception: Original exception who invoke this method
@@ -34,14 +40,28 @@ class DefaultErrorBuilder(ErrorBuilderInterface):
     details = marshmallow.fields.Dict(required=False, missing={})
     code = marshmallow.fields.Raw(missing=None)
 
-    def build_from_exception(self, exception: Exception) -> dict:
+    def build_from_exception(
+        self,
+        exception: Exception,
+        include_traceback: bool = False,
+    ) -> dict:
         """
         See hapic.error.ErrorBuilderInterface#build_from_exception docstring
         """
         # TODO: "error_detail" attribute name should be configurable
+        message = str(exception)
+        if not message:
+            message = type(exception).__name__
+
+        details = {
+            'error_detail': getattr(exception, 'error_detail', {}),
+        }
+        if include_traceback:
+            details['traceback'] = traceback.format_exc()
+
         return {
-            'message': str(exception),
-            'details': getattr(exception, 'error_detail', {}),
+            'message': message,
+            'details': details,
             'code': None,
         }
 
diff --git a/hapic/ext/bottle/context.py b/hapic/ext/bottle/context.py
index c5090b8..ba8d75a 100644
--- a/hapic/ext/bottle/context.py
+++ b/hapic/ext/bottle/context.py
@@ -33,12 +33,14 @@ class BottleContext(BaseContext):
         self,
         app: bottle.Bottle,
         default_error_builder: ErrorBuilderInterface=None,
+        debug: bool = False,
     ):
         self._handled_exceptions = []  # type: typing.List[HandledException]  # nopep8
         self._exceptions_handler_installed = False
         self.app = app
         self.default_error_builder = \
             default_error_builder or DefaultErrorBuilder()  # FDV
+        self.debug = debug
 
     def get_request_parameters(self, *args, **kwargs) -> RequestParameters:
         path_parameters = dict(bottle.request.url_args)
@@ -164,3 +166,6 @@ class BottleContext(BaseContext):
         See hapic.context.BaseContext#_get_handled_exception_class_and_http_codes  # nopep8
         """
         return self._handled_exceptions
+
+    def is_debug(self) -> bool:
+        return self.debug
diff --git a/hapic/ext/flask/context.py b/hapic/ext/flask/context.py
index 0908dc2..b548d11 100644
--- a/hapic/ext/flask/context.py
+++ b/hapic/ext/flask/context.py
@@ -32,11 +32,13 @@ class FlaskContext(BaseContext):
         self,
         app: Flask,
         default_error_builder: ErrorBuilderInterface=None,
+        debug: bool = False,
     ):
         self._handled_exceptions = []  # type: typing.List[HandledException]  # nopep8
         self.app = app
         self.default_error_builder = \
             default_error_builder or DefaultErrorBuilder()  # FDV
+        self.debug = debug
 
     def get_request_parameters(self, *args, **kwargs) -> RequestParameters:
         from flask import request
@@ -165,3 +167,6 @@ class FlaskContext(BaseContext):
         http_code: int,
     ) -> None:
         raise NotImplementedError('TODO')
+
+    def is_debug(self) -> bool:
+        return self.debug
diff --git a/hapic/ext/pyramid/context.py b/hapic/ext/pyramid/context.py
index d39b615..6fcde49 100644
--- a/hapic/ext/pyramid/context.py
+++ b/hapic/ext/pyramid/context.py
@@ -31,11 +31,13 @@ class PyramidContext(BaseContext):
         self,
         configurator: 'Configurator',
         default_error_builder: ErrorBuilderInterface = None,
+        debug: bool = False,
     ):
         self._handled_exceptions = []  # type: typing.List[HandledException]  # nopep8
         self.configurator = configurator
         self.default_error_builder = \
             default_error_builder or DefaultErrorBuilder()  # FDV
+        self.debug = debug
 
     def get_request_parameters(self, *args, **kwargs) -> RequestParameters:
         req = args[-1]  # TODO : Check
@@ -189,3 +191,6 @@ class PyramidContext(BaseContext):
         http_code: int,
     ) -> None:
         raise NotImplementedError('TODO')
+
+    def is_debug(self) -> bool:
+        return self.debug

Error catching: erro details must be given by default
When error is catch and transformed to response, error information must be hidden by default. A parameter like "debug" should be able to return it.
diff --git a/tests/unit/test_decorator.py b/tests/unit/test_decorator.py
index e088a8a..08906a4 100644
--- a/tests/unit/test_decorator.py
+++ b/tests/unit/test_decorator.py
@@ -276,7 +276,7 @@ class TestExceptionHandlerControllerWrapper(Base):
         response = func(42)
         assert HTTPStatus.INTERNAL_SERVER_ERROR == response.status_code
         assert {
-                   'details': {},
+                   'details': {'error_detail': {}},
                    'message': 'We are testing',
                    'code': None,
                } == json.loads(response.body)
@@ -305,7 +305,7 @@ class TestExceptionHandlerControllerWrapper(Base):
         assert response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR
         assert {
             'message': 'We are testing',
-            'details': {'foo': 'bar'},
+            'details': {'error_detail': {'foo': 'bar'}},
             'code': None,
         } == json.loads(response.body)
 
@@ -314,7 +314,11 @@ class TestExceptionHandlerControllerWrapper(Base):
             pass
 
         class MyErrorBuilder(DefaultErrorBuilder):
-            def build_from_exception(self, exception: Exception) -> dict:
+            def build_from_exception(
+                self,
+                exception: Exception,
+                include_traceback: bool = False,
+            ) -> dict:
                 # this is not matching with DefaultErrorBuilder schema
                 return {}
 

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov
3.6
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
beautifulsoup4==4.12.3
bottle==0.13.2
certifi==2021.5.30
charset-normalizer==2.0.12
click==8.0.4
coverage==6.2
dataclasses==0.8
Flask==2.0.3
-e git+https://github.com/algoo/hapic.git@730d2bee7907ae8f68de012c1cfd3e059840ae9e#egg=hapic
hapic-apispec==0.37.0
hupper==1.10.3
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
itsdangerous==2.0.1
Jinja2==3.0.3
MarkupSafe==2.0.1
marshmallow==2.21.0
multidict==5.2.0
packaging==21.3
PasteDeploy==2.1.1
plaster==1.0
plaster-pastedeploy==0.7
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pyramid==2.0.2
pytest==7.0.1
pytest-cov==4.0.0
PyYAML==6.0.1
requests==2.27.1
soupsieve==2.3.2.post1
tomli==1.2.3
translationstring==1.4
typing_extensions==4.1.1
urllib3==1.26.20
venusian==3.0.0
waitress==2.0.0
WebOb==1.8.9
WebTest==3.0.0
Werkzeug==2.0.3
zipp==3.6.0
zope.deprecation==4.4.0
zope.interface==5.5.2

name: hapic
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - beautifulsoup4==4.12.3
      - bottle==0.13.2
      - charset-normalizer==2.0.12
      - click==8.0.4
      - coverage==6.2
      - dataclasses==0.8
      - flask==2.0.3
      - hapic-apispec==0.37.0
      - hupper==1.10.3
      - idna==3.10
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - itsdangerous==2.0.1
      - jinja2==3.0.3
      - markupsafe==2.0.1
      - marshmallow==2.21.0
      - multidict==5.2.0
      - packaging==21.3
      - pastedeploy==2.1.1
      - plaster==1.0
      - plaster-pastedeploy==0.7
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pyramid==2.0.2
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - pyyaml==6.0.1
      - requests==2.27.1
      - soupsieve==2.3.2.post1
      - tomli==1.2.3
      - translationstring==1.4
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - venusian==3.0.0
      - waitress==2.0.0
      - webob==1.8.9
      - webtest==3.0.0
      - werkzeug==2.0.3
      - zipp==3.6.0
      - zope-deprecation==4.4.0
      - zope-interface==5.5.2
prefix: /opt/conda/envs/hapic

tests/unit/test_decorator.py::TestExceptionHandlerControllerWrapper::test_unit__exception_handled__ok__nominal_case tests/unit/test_decorator.py::TestExceptionHandlerControllerWrapper::test_unit__exception_handled__ok__exception_error_dict
tests/unit/test_decorator.py::TestControllerWrapper::test_unit__base_controller_wrapper__ok__no_behaviour tests/unit/test_decorator.py::TestControllerWrapper::test_unit__base_controller__ok__replaced_response tests/unit/test_decorator.py::TestControllerWrapper::test_unit__controller_wrapper__ok__overload_input tests/unit/test_decorator.py::TestInputControllerWrapper::test_unit__input_data_wrapping__ok__nominal_case tests/unit/test_decorator.py::TestInputControllerWrapper::test_unit__multi_query_param_values__ok__use_as_list tests/unit/test_decorator.py::TestInputControllerWrapper::test_unit__multi_query_param_values__ok__without_as_list tests/unit/test_decorator.py::TestOutputControllerWrapper::test_unit__output_data_wrapping__ok__nominal_case tests/unit/test_decorator.py::TestOutputControllerWrapper::test_unit__output_data_wrapping__fail__error_response tests/unit/test_decorator.py::TestExceptionHandlerControllerWrapper::test_unit__exception_handler__error__error_content_malformed
hapic/ext/pyramid/context.py hapic/ext/flask/context.py hapic/decorator.py hapic/ext/bottle/context.py hapic/error.py hapic/context.py
hapic/ext/pyramid/context.py hapic/ext/flask/context.py hapic/decorator.py hapic/ext/bottle/context.py hapic/error.py hapic/context.py