Give us feedback
guard-clauses
Service icon

Guard Clauses

Stable version 1.1.0 (Compatible with OutSystems 11)
Uploaded on 27 Apr (13 days ago) by 
5.0
 (1 rating)
guard-clauses

Guard Clauses

Details
Ensure the correctness of your data by enforcing preconditions, enhancing code readability and reliability
Read more

Guard Clauses are conditional checks placed at the beginning of an action to validate input parameters or preconditions. If the conditions are not met, an exception is thrown, preventing the execution of the rest of the action.

Why Guard Clauses?

  • Ensure that input parameters are valid before proceeding with the main logic of a method.
  • Improve code readability by clearly stating the expectations and constraints.
  • Fail fast: stop the method execution early if the conditions are not met.


Why do I need it in OutSystems?

Even though setting parameters as 'mandatory' ensures some correctness, it is still possible to fill them with null or empty values. Furthermore, when the parameters come from computed values (like the result of another action), there is little to no guarantee that they are in the format we expect. 

Guard Clauses in OutSystems serve as indispensable guardians of your application's integrity, promoting data correctness, simplifying error handling, and bolstering code reliability throughout the development lifecycle. 


Release notes (1.1.0)

Added new constraints:

- EnsureTextMaxLength

- EnsureTextMinLength

- EnsureNumberAtMax

- EnsureNumberAtMin

Converted app to service

Improved descriptions

License (1.1.0)
Reviews (0)
Team