simplesamlphp / simplesamlphp/saml2

Add own exceptions to the library

Open
#37 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0 - Backlog enhancement
Dominant language
PHP
Stars
306
Forks
138
PR merge metrics
No merged PRs in 30d

Description

While trying to add more meaningful messages to some of the typical errors, I've noticed that at some points in the library we are throwing simple exceptions with a message that's not really descriptive of the real problem, nor even translated. For instance, in \SAML2\SOAP::receive():

        $postText = file_get_contents('php://input');

        if (empty($postText)) {
            throw new Exception('Invalid message received to AssertionConsumerService endpoint.');
        }

or in \SAML2\Binding::getCurrentBinding():

        throw new Exception('Unable to find the current binding.');

If these were custom exceptions, we could capture them easily and display a meaningful, translated error message to the user, depending on where we are. Therefore I think we should even move some of the exceptions in SimpleSAMLphp to this library, and extend them with specific ones.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the exception sites named in \SAML2\SOAP::receive() and \SAML2\Binding::getCurrentBinding(), then inspect the library's other simple exceptions. Define the custom exception scope and how exceptions from SimpleSAMLphp should move into this library. Done means the relevant errors use specific exceptions that callers can capture and present with meaningful, translated messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.