Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API Proposal]: public ctor for CookieException with string parameter #95965

Open
mateusz-dobrowolny opened this issue Dec 13, 2023 · 7 comments · May be fixed by #109026
Open

[API Proposal]: public ctor for CookieException with string parameter #95965

mateusz-dobrowolny opened this issue Dec 13, 2023 · 7 comments · May be fixed by #109026
Assignees
Labels
api-approved API was approved in API review, it can be implemented area-System.Net in-pr There is an active PR which will close this issue when it is merged
Milestone

Comments

@mateusz-dobrowolny
Copy link

Background and motivation

CDD - Cookie Driven Development

API Proposal

namespace System.Net
{
    [Serializable]
    [...]
    
    public class CookieException : FormatException, ISerializable
    {
        public CookieException() : base()
        {
        }

        // Please make this public
        public CookieException(string? message) : base(message)
        {
        }

Please change access modifier for ctor with string? to public.

API Usage

throw new CookieException("🥮");
throw new CookieException("🍥");
throw new CookieException("🍪");
throw new CookieException("🍩");
throw new CookieException("🍰");

Alternative Designs

Alternatively make it protected, so I still can initialize CookieException with particular cookie.

Risks

Instance of CookieMonster may appear unexpectedly.

@mateusz-dobrowolny mateusz-dobrowolny added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Dec 13, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 13, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Dec 13, 2023
@mateusz-dobrowolny mateusz-dobrowolny changed the title [API Proposal]: [API Proposal]: public ctor for CookieException with string parameter Dec 13, 2023
@vcsjones vcsjones added area-System.Net and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Dec 13, 2023
@ghost
Copy link

ghost commented Dec 13, 2023

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Background and motivation

CDD - Cookie Driven Development

API Proposal

namespace System.Net
{
    [Serializable]
    [...]
    
    public class CookieException : FormatException, ISerializable
    {
        public CookieException() : base()
        {
        }

        // Please make this public
        public CookieException(string? message) : base(message)
        {
        }

Please change access modifier for ctor with string? to public.

API Usage

throw new CookieException("🥮");
throw new CookieException("🍥");
throw new CookieException("🍪");
throw new CookieException("🍩");
throw new CookieException("🍰");

Alternative Designs

Alternatively make it protected, so I still can initialize CookieException with particular cookie.

Risks

Instance of CookieMonster may appear unexpectedly.

Author: mateusz-dobrowolny
Assignees: -
Labels:

api-suggestion, area-System.Net, untriaged

Milestone: -

@antonfirsov
Copy link
Member

Personally I would be fine with this, and it looks like a trivial addition. Most BCL exception constructors allow passing a message string, it's CookieException that seems to be exceptional in this sense.

@dotnet/ncl any objections against marking this ready for review?

@antonfirsov antonfirsov added api-ready-for-review API is ready for review, it is NOT ready for implementation and removed untriaged New issue has not been triaged by the area owner labels Jan 8, 2024
@antonfirsov antonfirsov added this to the Future milestone Jan 8, 2024
@antonfirsov
Copy link
Member

Triage: assigned to Future given it's not critical. Once the API is approved, we can mark it help wanted, since it's a good candidate for community contribution.

@MihaZupan MihaZupan removed the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Mar 9, 2024
@terrajobst
Copy link
Member

terrajobst commented Aug 13, 2024

Video

  • We should also add the one that takes inner exceptions, for consistency with other exceptions
namespace System.Net;

public partial class CookieException
{
    // Existing ctors:
    // public CookieException();
    // public CookieException(SerializationInfo, StreamingContext);
    public CookieException(string? message);
    public CookieException(string? message, Exception? innerException);
 }

@terrajobst terrajobst added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review API is ready for review, it is NOT ready for implementation labels Aug 13, 2024
@antonfirsov antonfirsov added the help wanted [up-for-grabs] Good issue for external contributors label Aug 14, 2024
@mateusz-dobrowolny
Copy link
Author

@terrajobst Incredible! Attached video - transparency level 1000.
I am impressed. Really.

@terrajobst
Copy link
Member

@mateusz-dobrowolny

Glad you like it! You can find an aggregate of all our notes here, in case you're ever curious why a given API ended up like it did. I also link notes from API Catalog, for example here.

@deeprobin
Copy link
Contributor

@terrajobst @vcsjones Can I implement the feature? Happy to assign me.

@MihaZupan MihaZupan removed the help wanted [up-for-grabs] Good issue for external contributors label Oct 18, 2024
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-approved API was approved in API review, it can be implemented area-System.Net in-pr There is an active PR which will close this issue when it is merged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants