dev:error_handling
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| dev:error_handling [2025/03/08 13:41] – oschuett | dev:error_handling [2026/10/14 08:44] (current) – fstein | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Error Handling ====== | ====== Error Handling ====== | ||
| - | In CP2K there exist three convenient macros for error handling. They are defined in [[src>src/base/base_uses.f90]], and are therefore always available. However, these macros can only be used for **short messages** (approximately less than 7 words), because of Fortran' | + | This page has been moved to [[https://manual.cp2k.org/trunk/development/error-handling.html]] |
| - | <code Fortran> | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | </code> | + | |
| - | + | ||
| - | For longer messages one can use these two routines: | + | |
| - | <code Fortran> | + | |
| - | CALL cp_warn(__LOCATION__," | + | |
| - | "which can span multiple lines and contains "//& | + | |
| - | "some valuable advice for the user." | + | |
| - | + | ||
| - | CALL cp_abort(__LOCATION__," | + | |
| - | " | + | |
| - | </ | + | |
| - | + | ||
| - | <note important> | + | |
| - | Messages from '' | + | |
| - | </ | + | |
| - | + | ||
| - | ===== Cheat Sheet ===== | + | |
| - | If you want to... | + | |
| - | * print a **short warning** message, then you should use:< | + | |
| - | * print a **longer warning** message, then you should use:< | + | |
| - | "which can even span multiple lines" | + | |
| - | + | ||
| - | * **stop** the program with a **short** error message, then you should use:< | + | |
| - | * **stop** the program with a **longer** error message, then you should use:< | + | |
| - | " | + | |
| - | * have a **simple assertion** without a custom error message, then you should use:< | + | |
| - | * have a **simple assertion** with a **short** error message, then you should use:< | + | |
| - | * have a **complex assertion** with a **short** error message, then you should use:< | + | |
| - | CPABORT(" | + | |
| - | * have a **lengthy assertion** with a **longer** error message, then you should use:< | + | |
| - | CALL cp_abort(__LOCATION__," | + | |
| - | "which again can even span multiple lines" | + | |
dev/error_handling.txt · Last modified: by fstein
