Skip to content

Outlining the design patterns for customized exception and error messages#1264

Draft
miguelvaara wants to merge 1 commit intoskosmos-2from
issue1250-error-message-leaks-requested-sparql-endpoint-host
Draft

Outlining the design patterns for customized exception and error messages#1264
miguelvaara wants to merge 1 commit intoskosmos-2from
issue1250-error-message-leaks-requested-sparql-endpoint-host

Conversation

@miguelvaara
Copy link
Contributor

Reasons for creating this PR

To outline and create better exception and error handling practices

Link to relevant issue(s), if any

#1250
(Error message leaks requested SPARQL endpoint host)

  • Closes #

Description of the changes in this PR

The initial situation did not make it possible to easily create customized exception and error messages. At the moment many of the messages are hard coded and aim is to get rid of the hard coded messages.

This Draft Pull Request offers one alternative to improve the ways to customize exception and error handling or messages. It would be easy to use the static methods only for messaging or it is also possible to create instantiated classes for more dynamic error handling, depending on the needs.

Another option could be a separate key value based error message file to be referred to from the code but in that case there is no way to build any kind of customized logic to handle exceptions or errors.

Known problems or uncertainties in this PR

The PR needs more elaboration

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if not, explain why below)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

@miguelvaara miguelvaara self-assigned this Jan 19, 2022
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 4 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

Merging #1264 (c0c9a44) into master (b7fd768) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1264      +/-   ##
============================================
- Coverage     69.33%   69.30%   -0.04%     
- Complexity     1647     1648       +1     
============================================
  Files            32       33       +1     
  Lines          4044     4046       +2     
============================================
  Hits           2804     2804              
- Misses         1240     1242       +2     
Impacted Files Coverage Δ
controller/SkosmosExceptions.php 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7fd768...c0c9a44. Read the comment docs.

@miguelvaara miguelvaara changed the title Outlining the design patterns for self-made exception and error messages Outlining the design patterns for customized exception and error messages Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant