Skip to content

Commit

Permalink
Cross-reference Invalid Configuration with return code and mastering …
Browse files Browse the repository at this point in the history
…conditional (conan-io#1263)
  • Loading branch information
danimtb authored and lasote committed May 3, 2019
1 parent dc59c67 commit 92309a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mastering/conditional.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ There are two approaches for this situation:
if self.settings.os == "Windows":
raise ConanInvalidConfiguration("This library is not compatible with Windows")
.. tip::

Use the :ref:`invalid_configuration` exception to make Conan return with a special error code. This will indicate that the
configuration used for settings or options is not supported.

This same method is also valid for ``options`` and ``config_options()`` method and it is commonly used to remove options for one setting:

.. code-block:: python
Expand Down
2 changes: 2 additions & 0 deletions reference/commands/return_codes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Return code: ``5``

Execution terminated due to ``SIGTERM`` signal.

.. _invalid_configuration_return_code:

Invalid configuration
---------------------

Expand Down
2 changes: 1 addition & 1 deletion reference/conanfile/methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ it is an example of a recipe for a library that doesn't support Windows operatin
if self.settings.os != "Windows":
raise ConanInvalidConfiguration("Library MyLib is only supported for Windows")
This exception will be propagated and Conan application will exit with the error code ``6``.
This exception will be propagated and Conan application will finish with a :ref:`special return code <invalid_configuration_return_code>`.

requirements()
--------------
Expand Down

0 comments on commit 92309a2

Please sign in to comment.